Launch Sublime Text 3 from the Mac OSX Terminal
Sublime Text is a sophisticated cross-platform text and source code editor, with a Python application programming interface (API).Assuming you installed Sublime in the Applications folder, this following line opens Sublime Text editor when you type it into the Terminal:
open /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl
If that worked, you're ready to proceed.
You now need to create a symlink called sublime which links the subl CLI to a folder where your system usually looks to execute these binaries. To do this, type in:
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime
Check your profile
The final thing you need to do, is to check that your system profile is looking in the right place to see the symlink you have just created.
Enter the following command into your Terminal:
open ~/.bash_profile
Note that in some cases the profile may be called ~/.profile.
This should open up your profile in a text editor. What you’re looking for is a line towards the top of the file that starts with export PATH=. Your PATH contains all the directories that will be checked for executable binaries when you type a command into your Terminal. Since we created a symlink in the /usr/local/bin folder, we want to make sure that that folder is being checked too.
Hopefully, you’ll be able to see something similar to this:
export PATH=/usr/local/bin:(...)
If not, simply add this folder to your PATH and save the file.
Note: The (...) in this example represents other folders that would be listed on the same line and separated by a colon.
If you don't already have a PATH set in your bash_profile you can type the following on a new line:
export PATH=/usr/local/bin:$PATH
Finally, if you did have to add /usr/local/bin to your PATH, run the following command before continuing:
source ~/.bash_profile
This will reload your .bash_profile with the newly added directory in your PATH.
Test it works!
In your Terminal, the following commands should now work:
sublime . – opens the current directory in Sublime
sublime filename – opens a file where filename is the file to be opened
sublime foldername – opens a folder where foldername is the folder to be opened
And there you have it – you can now open any file or folder in Sublime straight from the Terminal.
Thanks and credit for this great solution to Artero
Also read:
- Sublime Text 3 Build 3065 License Key
- How to install install eclipse in ubuntu 12.04 (Linux)
- Top 5 Best Torrent Downloading 2014
- Top 5 Sites URL Shorten websites to Earn Money
- How Can You Earn Cash Online with Link Shortening WebSites
- Tricks for How to Make a WiFi Hotspot on your Windows 7/8 Laptop
- How to Import Wordpress to Blogger
- How to Install Emmet with Sublime Text 3
0 comments:
Post a Comment