Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set .bash_profile, if it does not exist yet. I want to launch sublime from a command line in Mac

Tags:

macos

I want to launch sublime from a command line in Mac, using subl filename. It seems to involve dealing with .bash_profile. But I didn't locate the file. What steps to be taken?

like image 986
L.Wu Avatar asked Aug 19 '16 11:08

L.Wu


People also ask

How do I start sublime text from terminal Mac?

First, navigate to a small folder in Terminal that you want ST to open and enter the following command: /Applications/Sublime\ Text. app/Contents/SharedSupport/bin/subl . NOTE: You may need to replace Sublime\ Text.

Where can I find .bash_profile in Mac?

Go the users home directory. Check if the bash_profile is visible there or not. If not, press Command + Shift + . and bash_profile will be visible.

What is bash profile in Mac?

bash_profile : it is simply a text file that sits in your home directory on Unix systems. The “bash” part of the filename comes from the popular interactive shell. Bash ships with macOS, so if you've ever done any work in the Terminal you've already used it!


1 Answers

A typical install of OS X won't create a .bash_profile for you. When you want to run functions from your command line, this is a must-have.

  1. Start up Terminal
  2. Type cd ~/ to go to your home folder
  3. Type touch .bash_profile to create your new file.
  4. Edit .bash_profile with your favorite editor (or you can just type open -e .bash_profile to open it in TextEdit.
  5. Type . .bash_profile to reload .bash_profile and update any functions you add. Notice the space between the two dots!
like image 83
tsaimyshoe Avatar answered Sep 21 '22 02:09

tsaimyshoe