If you’re not super familiar with using the command line, Terminal, or editing the path of your Terminal session, then it can be a bit scary. I know when I first tried it I was unsure even how to do it. So here’s a real quick and simple way to edit the PATH.
First, switch into your home directory by typing the
command. Then, you can open the
.bash_profile file in your favorite text editor. I use Sublime Text.
Now you will see a file that has something like this in it:
and possibly many other paths following that. You can also print out the current path in the Terminal using the
echo $PATH command.
So now that you have your
.bash_profile file open, you can edit it to add other paths if you need to. For example, if I wanted to add a ruby installation via rvm to my path, I could simply add it at the end of the path declaration like this:
I simply save this file, and you’re done! You can verify that the new path has been added by going back to Terminal and using the
echo $PATH command to print out what’s currently in the PATH.