Having trouble installing Rspec - ruby

So this is my first time asking a question here, so please bear with me. For the past few DAYS I've been trying to install rspec onto my system. After an introductory project a couple of months ago I became familiar with the fact that my Mac has ruby installed and it won't let me really install any gems as it would reply with a permissions denied notice. So I installed ruby from homebrew and went about my coding. Now present day I want to install rspec following a walkthrough I'm working on but the system won't let me. I've looked online and I thought it was my PATH and even tried changing it multiple times and it wouldn't work. At one point my terminal wouldn't even read the entirety of my bash_profile even though I source'd the file more than once. I've since updated to zsh and it's the exact same thing.
export PATH="/usr/local/opt:${PATH}"
export PATH="/usr/bin:/bin:/sbin:/sbin"
PATH="/usr/local/Cellar/ruby/2.7.2/bin:${PATH}" export PATH
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
# added by Anaconda3 2019.10 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/name/opt/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/Users/name/opt/anaconda3/etc/profile.d/conda.sh" ]; then
# . "/Users/name/opt/anaconda3/etc/profile.d/conda.sh" # commented out by conda initialize
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/Users/name/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/name/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/name/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/name/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/name/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
echo "Hello World"
export PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH="/usr/local/bin:$PATH"

Related

how to fix .bash_profile? pip3 is not installing packages to Anaconda Python (Mac OS 10.15.4)

After installing new packages using pip3 in my Conda env, I am not able to importing them in jupyter.
(base) MacBook-Air:~ johnsmith$ which python
/usr/bin/python
Looking at other posts, I understand this means that my default python is not the condo python install so I'm not getting the packages installed to the correct location. Also looking at other posts, I think I might need to fix my .bash_profile file to point pip3 to the right python version. Unfortunately, the file looks messy with several conda initializations. Maybe these are leftovers from previous condo installs. How do I fix this bash file? (I changed the user name but otherwise the file is identical).
export LD_LIBRARY_PATH=/Users/johnsmith/homework/mjpro131/bin
export PATH="$LD_LIBRARY_PATH:$PATH"
# added by Anaconda3 2019.10 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/opt/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
# . "/opt/anaconda3/etc/profile.d/conda.sh" # commented out by conda initialize
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/johnsmith/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/johnsmith/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/johnsmith/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/johnsmith/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<

$PATH not being set in .bash_profile

I use the MACOS Catalina 10.15.4. I am trying to set the PATH variable in the ~/.bash_profile.
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.7/bin"
export PATH="$PATH:/Users/some_user/Desktop/path_to_some_folder/bin"
# added by Anaconda3 2018.12 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
. "/anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
However, when I echo $PATH on the terminal I get the following:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
I checked my path is only being set from /etc/paths and /etc/paths.d.
How do I make sure that PATH is set from the .bash_profile file as well?
Also, I have .bash_profile-anaconda3.bak, .bash_sessions and .bash_history in my home directory if it makes any difference.
EDIT: I tried exporting PATH in .bashrc but that did not work either.
As suggested by #chepner, since all the new accounts on macOS use zsh now. I reconfigured my path using .zprofile.

Anaconda to Miniconda and $PATH

I am completely new to python and bash. I uninstalled Anaconda using conda clean and deleted the .anaconda_backup in my home directory. I opened the .bash_profile and did see
export PATH="/Users/XXXXX/anaconda3/bin:$PATH" and few other instances of $PATH appended.
My .bash_profile
# added by Anaconda3 5.3.1 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/XXXXXXXXXX/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/Users/XXXXXXXXXX/anaconda3/etc/profile.d/conda.sh" ]; then
# . "/Users/XXXXXXXXXX/anaconda3/etc/profile.d/conda.sh" # commented out by conda initialize
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/Users/XXXXXXXXXX/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
##
# Your previous /Users/XXXXXXXXXX/.bash_profile file was backed up as /Users/XXXXXXXXXX/.bash_profile.macports-saved_2019-01-19_at_19:04:16
##
# MacPorts Installer addition on 2019-01-19_at_19:04:16: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
# added by Anaconda3 2019.10 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/XXXXXXXXXX/opt/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/Users/XXXXXXXXXX/opt/anaconda3/etc/profile.d/conda.sh" ]; then
# . "/Users/XXXXXXXXXX/opt/anaconda3/etc/profile.d/conda.sh" # commented out by conda initialize
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/Users/XXXXXXXXXX/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
However, I didn't actually understood the part related to removing the Anaconda path from .bash_profile given in the manual. I ran echo $PATH again after uninstalling Anaconda and it looks exactly like before when i had Anaconda.
/opt/anaconda3/bin:/Users/XXXXX/opt/anaconda3/bin:/opt/local/bin:/opt/local/sbin:/Users/XXXXX/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I plan to install miniconda and create an environment for learning data science. I am trying to force myself to get more and more acquainted to terminal
Is it still safe to go ahead and install the Miniconda? How do I remove Anaconda path from .bash_profile? Will I be still able to open python by just typing the python command? or I would need to add a different path to access python after installing python through miniconda?

What are the bash commands to setup or recognize a MySQL installation on a Mac?

first post on so; let me know any advice on better asking
Anyways, my current bash profile is:
# added by Anaconda3 2019.10 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/opt/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/anaconda3/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
‘export PATH=/usr/local/mysql/bin:$PATH'
I was getting this info from the tutorial, https://www.youtube.com/watch?v=HXV3zeQKqGY , ~1 hour 7 mins in.
I don't have a conda env activated right now. Anyone have an idea why when I type "mysql" into my bash terminal I am returned "command not found"?
There may be a problem with you $PATH.
Open .bash_profile. and then Place export PATH=${PATH}:/usr/local/mysql/bin in it.

Anaconda installation modifying .bash_profile on Mac OS X

I installed Anaconda on my Mac (Mojave) and now whenever I start a shell it automatically activates the conda environment. This was totally fine until I realized some of the commands in my .bashrc were not being executed on startup. In particular, I had increased HISTSIZE and HISTFILESIZE but they always seemed to be stuck at their default values of 500. After some googling, I learnt that because of my anaconda installation, it was my .bash_profile that was being used on startup and not .bashrc. This is what my .bash_profile looks like (see below), just adding commands from my .bashrc file (e.g., HISTFILESIZE=100000) to the top of my .bash_profile appears to do nothing. Any suggestions on what I am doing wrong? Thanks!
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
# added by Anaconda3 2019.07 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
# . "/anaconda3/etc/profile.d/conda.sh" # commented out by conda initialize
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('//anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "//anaconda3/etc/profile.d/conda.sh" ]; then
. "//anaconda3/etc/profile.d/conda.sh"
else
export PATH="//anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
You can try to add the following lines in the bash_profile as suggested Here:
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

Resources