Applying Your Linux Skills to macOS: Understanding Apps

macOS is very different from Linux when it comes to apps. When you install an app in Linux via a package manager, the files that comprise the app itself are distributed across the file system in various directories. But in macOS, all of the binary executable files, supporting data files, configuration information and other app-related information are stored in a single directory called a bundle.
A Macbook with the headline Talk Tech to Me: Linux + macOS

This article is part three in a series about using Linux skills when working in a mac operating system. Check out the other articles in the series:

macOS is very different from Linux when it comes to apps. When you install an app in Linux via a package manager (e.g., *.rpm or *.deb), the files that comprise the app itself are distributed across the file system in various directories, such as /etc, /bin, /opt, /usr and /var.

In macOS, all of the binary executable files, supporting data files, configuration information and other app-related information are stored in a single directory called a bundle. Bundles are simply directories that end with the *.app extension. However, they do not look like directories when you view them in your Finder app – the *.app extension is hidden, and when you double-click the bundle icon, the app is loaded into memory and executed.

To execute an app from the command prompt, you can use the open command followed by the pathname to the app bundle (e.g., open /Applications/Firefox.app). Alternatively, if you drag the bundle icon to the Trash, you will remove the entire bundle directory and everything associated with your app – there will be no loose ends left on the system other than user-specific files and settings.

NOTE: To look inside a bundle, simply run the cd /Applications/bundle_name.app command from the Terminal app or right-click the bundle in the Finder app and choose Show Package Contents.

Apps typically rely on shared libraries, which are sets of reusable functions. In Linux, they are stored as shared objects in the /lib directory. However, in macOS these libraries are called Frameworks and are stored within bundle files that have the *.framework extension in the /System/Library/Frameworks directory. Frameworks are automatically advertised to running apps by the system.

The configuration information and settings for macOS apps are stored in plist files (*.plist) within the app bundle itself. Plist files are written in XML and can be easily modified to change how the app works on the system. For example, to rename the trash icon in your dock, you could open a terminal, switch to the root user (su - root) and run the following commands:

cd /System/Library/CoreServices/Dock.app/Contents/Resources/en.lproj

vi InfoPlist.strings

Next, change the line TrashName = “Trash” to TrashName = “Whateveryouwant” and save your changes when finished. To reload your dock to apply the changes, simply type the following at the command prompt:

killall Dock

macOS App File Associations

If you have several apps that can open a particular file type (e.g., two PDF readers), you can change the default app association for the file type (e.g., ensure that *.pdf files are opened with FoxIT Reader instead of Adobe Reader by default).

To change the default app file association in macOS:

  1. Right-click your file.
  2. Select Get Info.
  3. Change the section Open with.

Installing macOS Apps

Although you can compile apps from source code using the make utility (and gcc) as described in my article on macOS commands, most apps that you install in macOS are distributed as Disk Image Files (*.dmg) that are downloaded from a website or the Apple App Store.

Disk Image Files are an extension of ISO images (.iso). When you download a *.dmg file, it automatically mounts to a directory on your desktop such that you can access the files and apps within the *.dmg file itself.

When you access the mounted directory on your desktop, you will either see an icon that you can run to install the app or the app bundle itself that you can copy to the /Applications folder to install it on your local system. If you install an app via the Apple App Store, then this process is automated for you.

Stay tuned for next month's installment, where I'll be discussing devices and system initialization.

Round out your IT skill set with CompTIA Linux+.

Email us at [email protected] for inquiries related to contributed articles, link building and other web content needs.

Read More from the CompTIA Blog

Leave a Comment