Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Sublime Text

You're reading from   Mastering Sublime Text When it comes to cross-platform text and source code editing, Sublime Text has few rivals. This book will teach you all its great features and help you develop and publish plugins. A brilliantly inclusive guide.

Arrow left icon
Product type Paperback
Published in Dec 2013
Publisher Packt
ISBN-13 9781849698429
Length 110 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Dan Peleg Dan Peleg
Author Profile Icon Dan Peleg
Dan Peleg
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Mastering Sublime Text
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Installing Sublime Text FREE CHAPTER 2. Code Editing 3. Snippets, Macros, and Key Bindings 4. Customization and Theme Development 5. Unravelling Vintage Mode 6. Testing Using Sublime 7. Debugging Using Sublime 8. Developing Your Own Plugin Index

Installing Sublime Text on OS X


This section will explain how to install Sublime Text on OS X 10.7 or later, as required.

First go to http://www.sublimetext.com/3 and click on the download link for OS X. A file called Sublime Text Build #.dmg will be downloaded. Open this file and we will see the following window:

Simply drag the Sublime Text icon into the Applications folder and wait for the application to be copied.

We have just installed Sublime on our OS X! Is that all? No, we can also get the bleeding edge version from here: http://www.sublimetext.com/3dev. Bleeding edge versions are available for registered users only and are more susceptible to bugs.

Working with Sublime CLI

Sublime Text ships with a CLI called subl, but this CLI isn't added to our environment by default. We want to be able to use it straight from our terminal, so we need to add a symbolic link called subl to the subl executable.

ln –s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

To see if it worked, type subl filename in the terminal where filename is the file you want to edit. Did it work? If not, then we need to add our folder that contains the new symlink to the environment. Run the following command:

open ~/.bash_profile

The first line of the file should start with export PATH=. It contains all the directories that will be looked into for executable binaries when we type a command in the terminal. Since we created a symlink to subl inside the /usr/local/bin directory, we will add it to the path by adding it to the directories:

export PATH=/usr/local/bin[…]

Note

[…] represents other directories that would be listed on the same line, separated by a colon.

Now, run the following code before continuing:

source ~/.bash_profile

This will reload your .bash_profile with the newly added directory.

Sublime CLI should work now; try one of the following commands:

subl filename ("filename" is the filename to edit)
subl foldername ("foldername" is the folder to open)
subl . (to open the current directory)

That's it! We have Sublime Text with CLI running on our OS X!

You have been reading a chapter from
Mastering Sublime Text
Published in: Dec 2013
Publisher: Packt
ISBN-13: 9781849698429
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime