By Manny Fernandez

October 21, 2024

Syncing Sublime Text for macOS with iCloud

I have been playing with the free version of Sublime Text for macOS for years.  I mainly have been using UltraEdit for my text manipulation and coding.  I have been paying the subscription from UltraEdit on a yearly basis and it is starting to sting a bit.  I have cleaned up so many subscription services these past few months I figured I would keep going.

Installing Sublime Text

First things, first.  You do not have to “license” this software, however I tend to support organizations and developers of which I use their software.  At the writing of this article, it was $99.00 for the next few released and then you pay a renewal.  Still cheaper than other platforms since Sublime Text has been around for a decade and they are on v4.

Head over to their website

Click the download button.

I recommend installing the Package Installer

Inside Sublime Text click ⌘ ⇧ P

You will get a search box, and in it type Install Package and you should see the package install show up.  Select it.

I made some changes to mine such as font size, font etc.  You can do this by again typing ⌘ ⇧ P  and searching for preferences

Its Json format

{
"font_size": 15,
"font_face": "Jetbrains Mono",
"highlite_line": true,
"ignored_packages":
[

Now for the iCloud portion

MAIN COMPUTER – HOST

cd ~/Library/Application\ Support/Sublime\ Text/Packages
mkdir -p ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/WebDev/ST/Plugins
mv User ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/WebDev/ST/Plugins
ln -s ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/WebDev/ST/Plugins/User

These commands essentially move your configuration files to a syncable folder in iCloud Drive then sets up a symbolic link to the User folder under Sublime Text's new folder structure and where the app is expecting the files.

Next we will sync the User folder as well

cp -R ~/Library/Application\ Support/Sublime\ Text/Packages/User ~/User

-R If source_file designates a directory, cp copies the directory and
the entire subtree connected at that point. If the source_file
ends in a /, the contents of the directory are copied rather than
the directory itself. This option also causes symbolic links to be
copied, rather than indirected through, and for cp to create
special files rather than copying them as normal files. Created
directories have the same mode as the corresponding source
directory, unmodified by the process’ umask.

In -R mode, cp will continue copying even if errors are detected.

ON THE SECONDARY(S)

On the secondaries, you will need to install the full Sublime Text app and also enable the Package Installer.  Close out Sublime Text and run the following commands

cd ~/Library/Application\ Support/Sublime\ Text/Packages
rm -rf User
ln -s ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/WebDev/ST/Plugins/User

-R Attempt to remove the file hierarchy rooted in each file argument. The -R option implies the -d option. If the -i option is specified, the user is prompted for confirmation before each directory’s contents are processed (as well as before the attempt is made to remove the directory). If the user does not respond affirmatively, the file hierarchy rooted in that directory is skipped.

-r Equivalent to -R.

-f Attempt to remove the files without prompting for confirmation, regardless of the file’s permissions. If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error.  The -f option overrides any previous -i options.

All set, your Sublime Text should be syncing with the Host Mac.  I will be coming out with a Fortinet specific and Network Engineer specific article in the near future.

 

 

Recent posts