Law One:
sudo vi/etc/pathsto edit paths, add environment variables to paths. Vim is an editor, and there are several other, such as: Pico,emacs. Hint: When entering environment variable, do not enter one by one, just drag the folder into Terminal. Law II:1. Create a file:sudo touch/etc/paths.d/mysql2. Open this file with vim (if it is opened in open-t, edit is not allowed):sudo vim/etc/paths.d/mysql
3. Edit the file, type the path and save (Close the Terminal window and reopen one to use the MySQL command)/usr/local/mysql/binIt is said that it is possible to generate new files on their own, without having to put the variables in a paths file for easy management.
Law III:
1. Create and open the ~/.bash_profile file in TextEdit mode
Touch ~/.bash_profile;
open-t ~/.bash_profile
2. New Environment Variables
export path= "$HOME/.rbenv/bin: $PATH"
3. Allow the above configuration to take effect
Source ~/.bash_profile
4. Check if it takes effect (sometimes you may need to turn off the current Terminal window to reopen one)
Echo $PATH
one point to note (the colon is the delimiter for the environment variable):
$HOME/.rbenv/bin: $PATH in $PATH specifically/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
If you want to add more than one environment variable, you need to write it in the following way:
export path= "$PATH:/applications/macvim-snapshot-68"
export path= "$HOME/.rbenv/bin: $PATH"
eval "$ (rbenv init-)"
export path= "$HOME/.rbenv/bin: $PATH"
eval "$ (rbenv init-)"
Three ways to add environment variables to your Mac