Member-only story
How to Fix Apple’s Application Folder Problem.
If you want to access applications from the Terminal, and they are not appearing, you may have to manually configure your Mac.
This tutorial explains how to do just that with a single python script.
Knowing the structure of the Applications folder
On a mac, the system applications folder is located in \Applications
, however if we wish to access a program we have to go to /Applications/AppName.app/Content/MacOS/Appname
in order to run it.
This can be verbose and time consuming on the best of days. That is where our solution comes into play;
Importing the Libraries
As with all our code we start by importing any libraries. In this case we wish to pattern match, perform operating system commands and get files.
import os,glob,re
We also want to programatically extract all our applications and define a directory where we will place them — in my case I have named it ‘localbin’.
loc = os.path.expanduser('~/localbin')
files = glob.glob('/Applications/*.app/Contents/MacOS/*')