M2C3b – Install & Configure Sublime Text on macOS

Class Objectives:

By the end of this class, you will be able to:

  1. Install Sublime Text on a Mac.
  2. Create a new Sublime Text project from the given template.
  3. Quickly search/replace text across your entire project.
    Sublime Text Installation
    Here in this class, we’ll install Sublime Text and learn its basics.
    All the server configuration files are in text format and can be edited using a text editor. There are basically 2 types of editors: Text Editors and Word Processors. Text Editors just create and edit text. They don’t add formatting paraphernalia to it. Whereas Wordprocessors add all sorts of mumbo jumbo to the text. Though that mumbo jumbo is not usually visible to us, but it’s always there within the files created. MS Word, Open Office, Libre Office, Google Docs are all examples of Word Processors, which we shall avoid to edit server files. Whereas Sublime Text, Brackets, Vim, Nano, Atom, BBEdit etc. are all Text Editors.
    Here in this course, we’ll use Sublime Text Editor. It’s available for all the major platforms, including Windows, Mac, and Linux. Though it’s not free, but comes with an unlimited trial.
    It’s now time to install Sublime Text.
    Please visit sublimetext.com.
    Here we’re on Sublime Text website.
    Click Download for MAC, button.
    Allow the downloads from sublimetext.com.
    The download is complete.
    Right click and select Open.
    Drag and drop Sublime Text icon to Applications folder.
    Sublime Text is installed. Firing it up.
    It’s asking that Sublime Text is an app downloaded from the Internet. Do you want to open it?
    Yes.
    Expanding the screen size by double clicking the top bar.
    So this is its main Window. Nothing much here. Now I want you to download the Coming Soon Project file from this class’s resources.
    Let’s download it.
    Open Downloads.
    Open the Coming Soon.zip.
    There’s just one folder in the zipped file “yourserver.yourdomain”
    Right click it and select Copy.
    Now go to “My Documents” and create a folder “Running Servers”
    Now paste the folder yourserver.yourdomain here.
    I’m renaming this folder to sun.mindbuild.com. Here sun is our would be server name, and mindbuild.com is our domain name. These both combine to form a hostname.
    A hostname is a user-friendly name that is associated with a computer’s IP address.

A hostname consists of 2 names: Alias or the server name and the domain name. It’s also called Fully Qualified Domain Name or FQDN.

The hostname can contain letters from a to z, digits from 0 to 9, minus sign or the hyphen, and can be up to 255 characters long.

While naming your server, you can:

Describe the server’s purpose such as just being a server – like server 1, server2, server3 , or a backup-server, or a development-server, etc.
Indicate its location like NewYork1, London1, etc.
Use an abbreviated owner or company name such as mff1, mbt1, or mindbuilt1.
We mostly use solar system, stars, galaxies etc. for our host names, like sun, moon, jupiter etc.

Don’t think too much about that. Just be Intuitive and choose an easy to remember name. If you don’t own a domain, we’ll go through the full process of registering a domain name later in the Class no: M4 C2 – Domain Registration & Name Servers. In the meanwhile, you can always search for a domain name that is free at:
namesilo.com
So here is the main folder sun.mindbuild.com which contains our “Coming Soon” page and will later on, contain all our server’s modified files and folders.
Now just drag and drop this folder sun.mindbuild.com to Sublime Text.
You can see that a sidebar has appeared.
On the sidebar, expand Coming Soon folder, and click index.html file.
This is all html the basic building blocks of a website.
On the right side, we have this text scroll bar. it comes real handy when dealing with large text files. I really miss it in other programs like Scrivener, which we shall cover shortly.
We’ll now save it as a project. The benefit of saving this folder as a project is that we’ll be able to perform quick searches as well as search and replace operations across all the files contained in this folder.
To save it as a Project click Project, and then Save Project As…
Save Project as yourservername.yourdomainname, without the suffix that is dot com. I didn’t check it in Mac, but on Windows, Sublime Text has issues using the dot com suffix. I’m saving it as sun.mindbuild.sublime-project
Choose a Color tag. It’s just an identifier, which makes identifying projects easy while switching different projects. You can assign the same color tag to the projects of the same category, like web servers, email servers etc.
In the Where field select the parent folder, in my case sun.mindbuild.com.
Save the project.
So our project is now created.
Now I’d like you to try searching for some text.
Press Command+F
Type Coming, enter, so we have got 2 matches.
Let’s suppose we want to search Coming across all the folders.
Simply press Command+Shift+F or select “Find in Files” from the Find drop down on the top menu. and then search Coming: Now we have got 4 matches across all the folders. This key combination searches files across the whole project.
Of course, we can replace text across all the files by using the same Command+Shift+F combination.
We also have these search criteria like Regular Expression, Case Sensitive, Full Word, etc which come in handy in different situations.
So that’s all.
Let’s repeat what we have achieved in this class:

  1. We installed Sublime Text on our MAC.
  2. Created a new project.
  3. Learned how to search and replace text in files across the whole Project.
    In the next class we’ll install WinSCP on Windows. You may want to skip to the class next to it, in which we install FileZilla on macOS.
    Thank you.