Hello I downloaded Python from Homebrew but my computer seems to be using the pre installed Apple version.
Is there a way to change this so that my computer can use the Homebrew Python instead?
I read something about bash files on here but I can only see the apple stuff in there. There is nothing in there from usr/local/Cellar.
Because i do not know what you already did and if you installed Homebrew correctly or not i would write out the steps of how you should have done it. I will tell you how to install Homebrew and how to point your package to your path so it locates your python before the Apple python. Also i am assuming you have El Capitan.
1) Download Xcode form App Store if you don't have it.
Steps 2-9 are using Terminal (Applications -> Utilities -> Terminal)
2) Install the command line tools
xcode-select --install
3) Install Homebrew (This will install Homebrew to the root):
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
4) Update brew and check with the doctor to fix any issues:
brew update
brew doctor
5) Check if you already have a .bash_profile and if not create it.
a) Check for the .bash_profile
cd $HOME
ls -al
If you see .bash_profile on the list skip (b)
b) Create the bash profile
cd $HOME
touch .bash_profile
7) Export the Path to the bash file:
cd $HOME
echo export PATH=/usr/local/bin:/usr/local/sbin:$PATH >> ~/.bash_profile
source ~/.bash_profile
8) Install your package, for example:
brew install python
9) Run the doctor and fix any issues:
brew doctor
10) Check the Path and make sure that the /usr/local/bin: is before /usr/local/
$PATH
If during the process you get an error saying that you do not have permission add sudo in front of the command and try again.
Hope it helps!
Related
I have a new laptop with Sierra. I brought my applications from my old mac with Time Machine and most of them are working fine. However, Macvim disappeared. I tried to install it.
I tried to re-install it by installing Homebrew and brew installing macvim. The install looks successful, but I still cannot find nor use macvim. I guess this is a matter again of application files no longer being in /usr/ but in Library/, but honestly I am a bit lost as to how to figure out whether this is the problem and how to fix it.
Can you please help me out with this?
How I installed Homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
How I installed Macvim:
brew install macvim
MacVim is keg-only.
If you run this command after installation:
brew linkapps
you will find MacVim in your Applications folder in finder.
Since linkapps is now deprecated, I've had to manually link .app via
ln -Fs `find /usr/local -name "MacVim.app"` /Applications/MacVim.app
Unfortunately, Spotlight cannot find MacVim this way. Therefore, I've (after opening the app by double-clicking on the icon in Finder's Applications folder) right-clicked on the app's icon on the dock and selected Option -> Keep in Dock.
The symbolic soft link solution described by #laylaylom works; but I am having trouble setting MacVim as my default app for some filetype. Then I found this from here:
% mkdir ~/Applications/Emacs.app
% ln -s /usr/local/Cellar/emacs/23.2/Emacs.app/Contents ~/Applications/Emacs.app
That solution was for Emacs.app but it can work with MacVim as well:
% mkdir ~/Applications/MacVim.app
% ln -Fs /usr/local/Cellar/macvim/8.1-151/MacVim.app/Contents ~/Applications/MacVim.app
There is now a cask for MacVim, but it's not the default. The correct command is:
brew install homebrew/cask/macvim
This will install MacVim in the Applications folder, and make it available to Spotlight.
No error appears when I run
yo angular appname
I have already installed yeoman and I am using ubuntu 12.10
Reinstall the yeoman
sudo npm install -g yo
Watch out for the last part of your installation.
Notice that for my output,
/usr/bin/yo -> /usr/lib/node_modules/yo/bin/yo
My solution is
sudo nano ~/.bash_profile
Inside the ~/.bash_profile
export PATH=/usr/bin:/usr/lib/node_modules:$PATH
Basically add the paths where yo belongs to
Then execute the .bash_profile
. ~/.bash_profile
Now you can run the yo angular appname
If you have updated nodejs to latest version (Mine is v0.10.33)
Open /usr/lib/node_modules/yo/cli.js
and update #!/usr/bin/env node to #!/usr/bin/env nodejs
OSX - 10.8.5
Running Homebrew
rvm
Whenever I open a new shell I get the following and I think, "ugh", thats not good.
Last login: Thu Nov 7 07:12:43 on ttys000
-bash: /etc/profile.d/rvm.sh: No such file or directory
I then run echo $PATH and get
Matthews-MacBook-Pro-2:~ Matthew$ echo $PATH
/Users/Matthew/.rvm/gems/ruby-1.9.3-p448/bin:/Users/Matthew/.rvm/gems/ruby-1.9.3-p448#global/bin:/Users/Matthew/.rvm/rubies/ruby-1.9.3-p448/bin:/Users/Matthew/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/ImageMagick/bin:/usr/local/bin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/local/rvm/gems/ruby-1.9.3-p448/bin:/usr/local/rvm/gems/ruby-1.9.3-p448#global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p448/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Matthews-MacBook-Pro-2:~ Matthew$
I think my .bash_profile is a mess and I really would appreciate some ninja guidance...
Thank you
When you open the Terminal, you begin a bash shell session. You can set some commands to run every time you start a bash session. The place to put these initial bash commands is usually in ~/.bashrc or ~/.bash_profile. See if you have any reference to the file /etc/profile.d/rvm.shthere and check if that file actually exists on your machine.
UPDATE:
I have heard of problems if o installed rvm as sudo. Try removing it and reinstalling again without sudo:
sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc /etc/profile.d/rvm.sh \
/usr/local/rvm /usr/local/bin/rvm
sudo /usr/sbin/groupdel rvm # this might fail, it's not that important
Reopen terminal and make sure rvm ins removed:
env | grep rvm
It should return empty if not try to restart de computer. After it return empty you can install it:
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
I followed this tutorial below:
https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
This worked perfectly for me; however, I have one small problem?
Each time I open a new terminal I have to run this command in order for rails to work:
source ~/.rvm/scripts/rvm
What is the problem and why is rvm not recognized
This is what I see after I open a new terminal and verify rails:
robert#rob:~$ rails -v
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
Thanks
I highly recommend you to use the official website to install RVM: https://rvm.io/rvm/install
Your problem is that RVM is not loaded when you open a new terminal, this is why you have to manually add the source at each instance of the Terminal.
To solve this, run this command line: (if using login-shell)
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
Or this (if using non-login shell):
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bashrc
This will add the path to RVM to load at each Terminal instanciation (close & re-open a terminal after you did this).
Take a look at #mpapis comments
I know the above question is very common question. I have gone through multiple posts on this topic. But I didn't get any resolution.
I have installed rvm locally. We already have the installation files. SO went into the folder and run the install command.
$ ./install
Then I checked ./rvm folder in the Users home folde
$ cd ~/.rvm
folder exists. Hence Installation is successful.
Now I am typing rvm in the command line
$ rvm
I am getting below exception
$ rvm
-sh: rvm: command not found
After reading the multiple articles in stackoverflow on this issue, I learned that I have to add the below lines in .bash_profile as I am using Mac OSX 10.7.3
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Even after I am getting same exception while typing rvm. Is there any thing extra I need to do? or Am I missing some thing? Please help
Steps to try out:
Log out and login to your system.
Open a new terminal and manually run
source $HOME/.rvm/scripts/rvm
then
rvm
Check these work-arounds.
Update:
To avoid running
source $HOME/.rvm/scripts/rvm
every time you open a terminal, include this line into ~/.MacOSX/environment in your Mac (This is similar to ~/.bashrc in GNU/Linux-based systems under $home aka ~ directory).
In my case, i am using Ubuntu Bash in Windows 10 and to fix the problem i used:
source /usr/local/rvm/scripts/rvm
For those that are doing this in 2018 just
add
source $HOME/.rvm/scripts/rvm
to your .bash_profile within your home directory.
you need to enable login shell in terminal emulator preferences, sometimes it is needed to use /usr/bin/bash --login, here is an example https://rvm.io/integration/gnome-terminal/
after enabling login shell you need to close terminal application and open it fresh.
I just had to open a new Terminal session.
After I installed it using:
curl -sSL https://get.rvm.io | bash -s stable --ruby
rvm install 2.2
For Ubuntu 18.04, I had to run the command below to solve the issue after rvm was installed using instruction from here.
source /usr/share/rvm/scripts/rvm
This is one of other options available for RVM:
source /etc/profile.d/rvm.sh