Three ways to add environment variables to your Mac

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.