How to edit or update your Terminal Path

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.

sublime .bash_profile

Now you will see a file that has something like this in it:

export PATH=$PATH:/usr/local/bin

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:

export PATH=$PATH:/usr/local/bin:/usr/local/rvm/gems/ruby-2.2.0

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.
credit here


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s