
- SUBLIME TEXT 2 SHORTCUTS FOR MAC HOW TO
- SUBLIME TEXT 2 SHORTCUTS FOR MAC INSTALL
- SUBLIME TEXT 2 SHORTCUTS FOR MAC PASSWORD
This is done by hooking into a CLI utility that Sublime provides called subl.
SUBLIME TEXT 2 SHORTCUTS FOR MAC HOW TO
Launch Sublime Text 2 or 3 from the Mac OSX TerminalĪs I’m working in the OSX Terminal more and more these days, I'm always on the lookout for time saving shortcuts.Ī really useful tip that I picked up recently from Zander Martineau is how to open up Sublime Text straight from the Terminal. Once you’ve completed them, editing hosts files becomes as easy as editing any other text file on your computer.Front-end development Blog and Portfolio for Ashley Watson-Nolan – Senior UI Engineer at Just I know it looks like a lot of work, but it’s really only a couple of quick steps. Maybe I’ll go into that in another post sometime. This is tremendously useful if you are utilizing Name-based Virtual Host on a local apache web server (MAMP, WAMP, XAMP).

The lines from 15 down all send my browser to local installations of various CMS’s.

Now when I type in my browser I at least end up on the google servers instead and it’s pretty quick to get from there to gmail. Because I occasionally typo as and have no need to visit the site, I have aliased to the IP addresses of a couple of the servers at. I included lines 11-13 to demonstrate how you can override DNS for any domain and point it anywhere you like. You will likely not have anything below line 10 yet unless you’ve already done this before from the command line. The format is IP Address, a space or tab, and then the hostname.Here’s a sample host file: Lines 1-9 (or 10) on your host file may be slightly different from this example. Double-click EditHostsNow you have a new Sublime Text 2 window with your hosts file ready for editing.You are now ready to add entries and potentially override real DNS to point any name you like at any IP address you choose. Great, so now you’ve got this icon on your desktop but what does it do? When you double-click it, you get a new Sublime Text 2 window with your hosts file. Now when you double-click EditHosts, it should open a terminal window just long enough to run the sublime command and open the hosts file and then the window should close automatically on its own. Click the red X at the top to close the preferences window.Find where it says “When the shell exits:” and choose the “Close if shell exited cleanly” option.Click Settings tab at the top and find the “Shell” button on the right.Click Terminal and preferences at the top of your screen.This next step will tell terminal to close that window after it runs our script. If you’ve already double-clicked your EditHosts file, you’ve noticed that it leaves a terminal window behind when you’re done. Step 5: Configure Terminal to close on exit When you doubleclick this file, it will run the command to start sublime with a new window with your hosts file ready for editing.Īt this point, you can rename this file anything you like and it will still work. sh, but that’s unnecessary in this instance and may be confusing for people who’ve never been exposed to a unix shell. You have now created a shell script named EditHosts. This command changes directory to your Desktop and makes the EditHosts file executable for the user. Paste this command into your terminal window and hit enter: cd ~/Desktop/ chmod u+x EditHosts.Go back to your terminal window (see step 2 if you’ve closed it already).Step 4: Make the EditHosts file executable Name the file EditHosts and save it to your Desktop.Open Sublime and paste this into line 1: sublime -n /private/etc/hosts.Step 3: Create the EditHosts file in Sublime

SUBLIME TEXT 2 SHORTCUTS FOR MAC PASSWORD

Step 2: Create shortcuts to the sublime command line I say this as though you aren’t already using Sublime Text 2, but here is the link just in case something actually is wrong with you.
SUBLIME TEXT 2 SHORTCUTS FOR MAC INSTALL
Step 1: Download and Install Sublime Text 2 I’ve finally worked out a solution for those suffering from CLI-Phobias and rather than email it out to all of them, I thought I’d put it up here and point at it instead. I’ve spent a lot of time in the shell so that doesn’t bother me much, but the initial reaction to a command line interface or shell-based text editors for some people is to run screaming from the room. On the mac, you would normally do this from terminal using a command line similar to: Every developer has probably had to edit their hosts file to point to a dev server at some time or another.
