Set environment variables on Mac OS X Lion

后端 未结 16 1374
余生分开走
余生分开走 2020-11-22 11:01

When someone says \"edit your .plist file\" or \"your .profile\" or \".bash_profile\" etc, this just confuses me. I have no idea where these files are, how to create them if

16条回答
  •  眼角桃花
    2020-11-22 11:25

    Simplified Explanation

    This post/question is kind of old, so I will answer a simplified version for OS X Lion users. By default, OSX Lion does not have any of the following files:

    • ~/.bashrc
    • ~/.bash_profile
    • ~/.profile

    At most, if you've done anything in the terminal you might see ~/.bash_history

    What It Means

    You must create the file to set your default bash commands (commonly in ~/.bashrc). To do this, use any sort of editor, though it's more simple to do it within the terminal:

    1. %> emacs .profile
    2. [from w/in emacs type:] source ~/.bashrc
    3. [from w/in emacs type:] Ctrl + x Ctrl + s (to save the file)
    4. [from w/in emacs type:] Ctrl + x Ctrl + c (to close emacs)
    5. %> emacs .bashrc
    6. [from w/in emacs type/paste all your bash commands, save, and exit]

    The next time you quit and reload the terminal, it should load all your bash preferences. For good measure, it's usually a good idea to separate your commands into useful file names. For instance, from within ~/.bashrc, you should have a source ~/.bash_aliases and put all your alias commands in ~/.bash_aliases.

提交回复
热议问题