Advertisement
Guest User

Untitled

a guest
May 29th, 2015
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. #How To Edit Your PATH Environment Variables On Mac OS X
  2.  
  3. If you are new to Mac OS X, you may need to know how to edit your PATH. The good news is that this is an easy task on Mac OS X.
  4.  
  5. The recommended way is by editing your .bash_profile file. This file is read and the commands in it executed by Bash every time you log in to the system. The best part is that this file is specific to your user so you won’t affect other users on the same system by changing it.
  6.  
  7. ###Step 1: Open up a Terminal window (this is in your Applications/Utilites folder by default)
  8.  
  9. ###Step 2: Enter the follow commands:
  10.  
  11. ####touch ~/.bash_profile; open ~/.bash_profile
  12.  
  13. This will open the .bash_profile file in Text Edit (the default text editor included on your system). The file allows you to customize the environment your user runs in.
  14.  
  15. ###Step 3: Add the following line to the end of the file adding whatever additional directory you want in your path:
  16.  
  17. ####export PATH="$HOME/.rbenv/bin:$PATH"
  18.  
  19. That example would add ~/.rbenv to the PATH. The $PATH part is important as it appends the existing PATH to preserve it in the new value.
  20.  
  21. ###Step 4: Save the .bash_profile file and Quit (Command + Q) Text Edit.
  22.  
  23. ###Step 5: Force the .bash_profile to execute. This loads the values immediately without having to reboot. In your Terminal window, run the following command.
  24.  
  25. ####source ~/.bash_profile
  26.  
  27. That’s it! Now you know how to edit the PATH on your Mac OS X computer system. You can confirm the new path by opening a new Terminal windows and running:
  28.  
  29. ####echo $PATH
  30.  
  31. You should now see the values you want in your PATH.
  32.  
  33. [Updated 2/10/2012] The instructions now use the .bash_profile method of editing your PATH. This is preferred as it keeps the changes specific to your user. I also updated the instructions to use Text Edit instead of vim so it is easier for a beginner.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement