This article is part two in a series about using Linux skills when working in a mac operating system. Check out the other articles in the series:
Newer versions of macOS, including 10.11, ship with an implementation of LAPACK included in vecLib, which is included in macOS.So if your software is vecLib. Newer versions of macOS, including 10.11, ship with an implementation of LAPACK included in vecLib, which is included in macOS.So if your software is vecLib-aware, you may not need to install LAPACK at all. Prepare the Mac. Find a Mac that will work with the version of Linux we're using. There is no hard. Officially, the operating system that was available on that Mac at the time that you bought it is the oldest version of macOS that can run on that Mac. It's likely that an older OS won't include.
As you now know from my introductory article, macOS is a flavor of UNIX, similar to Linux. But unlike Linux, macOS does not support virtual terminals by default. Instead, you can use the Terminal app (/Applications/Utilities/Terminal) to obtain a command line terminal and BASH shell.
Alternatively, you can type >console as the username at the macOS login prompt (no password needed) to obtain a login prompt that allows you to log directly into a command line terminal and obtain a BASH shell.
After you obtain a BASH shell, you can run many of the same commands you've become accustomed to on Linux. It's also important to note that the same syntax rules that you used on Linux apply to BASH on macOS:
- All commands are case sensitive.
- Regular options (-h) and POSIX options (--help) are listed for most commands.
- The manual pages (man who) and the info pages (info who) list most command documentation. The help command displays BASH function help (help echo).
- Commands may be chained using semicolons (date; who).
- The Standard Output of one command may be sent to the Standard Input of another command using a pipe ( | ) symbol (ps aux | less).
- The Standard Output and Standard Error of a command may be redirected to a file (ls –l /Users > usersfile 2> errorfile).
- Single quotes protect all special shell characters, double quotes protect most shell characters (variables are one exception), backquotes perform command substitution (echo The date is `date`) and backslash protects the next character (echo You owe $4.50).
- The ~ metacharacter represents the user's home directories.
- Tab completes commands and file paths.
- Ctrl+C cancels a command by sending a SIGINT kill signal to the foreground process.
- Wildcard metacharacters may be used with commands, and regular expressions may be used within text utilities.
- BASH control structures and functions may be used to create BASH shell scripts.
NOTE: If you wish to perform system administration as the root user, you must first enable the root user using the Directory Utility app (in /System/Library/CoreServices/Applications). Once you open this app, simply select Change Root Password from the Edit menu.
Common macOS Commands
Below are some common macOS commands, organized by general function. Bookmark this page so you can refer back to it often. Although most options to these commands are identical between Linux and macOS, be sure to view the manual page for commands that you will use in the future.
System Documentation Commands in macOS
- man Displays/searches the manual page database
- apropos Searches the manual page database by keyword
- info Displays/searches the info page database
- help Displays help on BASH functions
File Management Commands in macOS
- pwd Displays the current directory
- cd Changes the current directory
- ls Lists files
- file Displays file type
- locate Finds files using a predefined database
- which Searches the PATH variable for files
- find Finds files on the filesystem based on certain criteria
- cp Copies files and directories
- mv Moves/renames files and directories
- rm Removes files and directories
- rmdir Removes empty directories
- mkdir Creates empty directories
- ln Creates hard links; the –s option is used to create symbolic links
- chown Changes ownership for files and directories
- chgrp Changes group ownership for files and directories
- chmod Changes the permissions (mode) on files and directories
- umask Changes the UMASK variable used to determine default permissions
Text Tools in macOS
- cat Views (concatenates) the contents of text files to the terminal screen
- more Views the contents of text files page by page
- less Views the contents of text files page by page with advanced text features
- head Displays the beginning of a text file
- tail Displays the end of a text file
- sort Sorts lines in text files
- wc Counts the number of lines, words and characters in a text file
- grep Searches text files for regular expressions
- egrep Searches text files for regular expressions (including extended ones)
- sed Edits text files using search-and-replace functions
- awk Edits and formats text using predefined functions
- ·vi (vim) The vi text editor (common to all UNIX systems)
- emacs The GNU Emacs text editor
- ·nano A small easy-to-use text editor based on the UNIX pico editor
Filesystem Administration in macOS
- mount Mounts a filesystem to a mount point directory – alternatively, you can use the mount_filesystem commands (where filesystem is the name of an appropriate filesystem) – see man mount for details.
- umount Unmounts a filesystem from a mount point directory
- pdisk May be used to create Apple disk partitions
- newfs_type Creates a new filesystem on a device (type = apfs, hfs, udf, exfat, msdos)
- fuser Determines the users accessing a certain file, directory or terminal
- df Displays disk free space by filesystem
- du Displays disk free space by directory
- quota Displays quotas for a certain user
- edquota Edits user quotas
- repquota Displays a report on quotas by user
- quotacheck Updates quota limits on the filesystem
Piquant bathing mac os. Disk quotas are configured differently in macOS. In Linux, you enable quotas using the appropriate option in /etc/fstab. However, /etc/fstab is not available in macOS. Instead, you must create two files in the root of the filesystem that you wish to enable quotas on (.quota.ops.user and .quota.ops.group).
Shutdown and System State in macOS
- shutdown Shuts down or reboots the system at a specified time
- halt Shuts down the system immediately
- reboot Reboots the system immediately
Compression, Backup and Software in macOS
- compress Compresses files using a Lempel-Ziv algorithm
- gzip Compresses files using a standard Lempel-Ziv algorithm
- bzip2 Compresses files using a block-sorting algorithm
- tar Used to create small tar archives and tarballs
- cpio Used to create full filesystem backups using a variety of options
- make Manages software compiling using gcc and Makefile settings
- gcc The GNU C compiler used to compile software
BASH Management in macOS
As in Linux, macOS stores its variables in environment files. The /etc/profile and /etc/bashrc files are used by default on the system. Each user can also create their own ~/.bash_profile and ~/.bashrc files. In addition, ~/.bash_logout may be used to perform tasks at shell exit. Here are more BASH management commands for macOS.
- set Displays all variables in your shell
- env Displays exported variables in your shell
- alias Creates special alias variables
- unalias Removes special alias variables
- export Creates and exports variables
- ulimit Sets BASH limits for users (e.g., maximum number of user processes)
Process Management in macOS
- ps Displays system and user processes (supports BSD-style options only)
- top Displays top processes and system statistics
- kill Sends kill signals to processes by process identification number (PID)
- killall Sends kill signals to processes by name
- jobs Displays background processes
- fg Moves a background process to the foreground
- bg Moves a foreground process to the background
- nice Changes the priority of a process as it is started
- renice Changes the priority of a running process
- at Schedules commands to run at a later time
- atq Views at jobs
- atrm Removes an at job
- crontab Edits user cron tables (used to repetitively schedule commands)
User and Group Administration in macOS
User and group administration differs slightly in macOS from Linux. There are no useradd or userdel commands. Instead, you must use the System Preferences utility to create user accounts properly. User information is stored in a directory database under the /var/db directory. The /etc/shadow file does not exist and the /etc/passwd and /etc/group files exist only to provide information to apps. Petunias basics version alex basics mac os.
- whoami Displays the current user name
- who am i Displays your username and computer information
- groups Displays the current user's group memberships
- id Prints the User ID (UID) and Group IDs (GIDs) for the current user
- chfn Changes the user description used by the finger command
- finger Displays user description information
- chsh Changes the shell for a user account
- passwd Changes the password for the current user (the root user may change other user's passwords by specifying the username as an argument)
- who Displays who is on the system
- w Displays who is on the system and what they are doing
Common Unix Printing System (CUPS) Printing in macOS
- lp Prints a file (lpr is supported for BSD compatibility)
- lpstat Views print jobs and printer status (lpq and lpc are supported for BSD
- compatibility)
- cancel Removes a print job from the print queue (lprm is supported for BSD
- compatibility)
- cupsaccept Allows jobs to enter a print queue
- cupsreject Prevents jobs from entering a print queue
- cupsenable Allows jobs to be sent to the printer from the print queue
- cupsdisable Prevents jobs from leaving the print queue
Network- and Security-Related Commands in macOS
Network devices have different names in macOS. The first ethernet adapter is called en0 (typically wired ethernet), and the second is called en1 (typically wireless ethernet). Ensure that you use System Preferences to change any network parameters, as they are not stored in text files as they are on Linux systems. For example, the /etc/resolv.conf file still exists in macOS and lists DNS servers configured in System Preferences, but it is not used by the system – it is merely there in case an app queries it. The only network-related file that is used actively and may be edited is /etc/hosts (for local host name resolution). Here are more network- and security-related commands in macOS.
- ifconfig Displays and configures TCP/IP network interfaces
- ping Tests connectivity between hosts
- whois Queries domain name registration information
- arp Views and manages the address resolution protocol (ARP) cache
- netstat Views TCP/IP network statistics and the routing table
- route Manages the TCP/IP routing table
- traceroute Traces an IP packet across routers
- hostname Sets the system host name
- host Resolves host names to IP addresses and vice versa
- nslookup Resolves host names to IP addresses and vice versa
- dig Resolves host names to IP addresses and vice versa
- su Switches your user account to another account
- sudo Performs tasks as another user via entries in the /etc/sudoers file
- last Displays a detailed list of previous user logins
- tcpdump Captures packets on a network interface
Ba Snake Mac Os 11
System and Miscellaneous Commands in macOS
- date Displays the current date and time
- exit Exits out of the shell (logout)
- echo argument Displays the argument to the terminal screen
- clear Clears the screen
- uname option Displays system information specified by the option; –a specifies all information
- uptime Lists system statistics and uptime
- cal Lists the calendar for the current month
- banner Prints an ASCII banner
- iostat Displays input/output (I/O) statistics for the system
Now you've got the macOS basics down, and you know the common commands. In the next installment, I'll be discussing apps. Stay tuned!
Filesystem Administration in macOS
- mount Mounts a filesystem to a mount point directory – alternatively, you can use the mount_filesystem commands (where filesystem is the name of an appropriate filesystem) – see man mount for details.
- umount Unmounts a filesystem from a mount point directory
- pdisk May be used to create Apple disk partitions
- newfs_type Creates a new filesystem on a device (type = apfs, hfs, udf, exfat, msdos)
- fuser Determines the users accessing a certain file, directory or terminal
- df Displays disk free space by filesystem
- du Displays disk free space by directory
- quota Displays quotas for a certain user
- edquota Edits user quotas
- repquota Displays a report on quotas by user
- quotacheck Updates quota limits on the filesystem
Piquant bathing mac os. Disk quotas are configured differently in macOS. In Linux, you enable quotas using the appropriate option in /etc/fstab. However, /etc/fstab is not available in macOS. Instead, you must create two files in the root of the filesystem that you wish to enable quotas on (.quota.ops.user and .quota.ops.group).
Shutdown and System State in macOS
- shutdown Shuts down or reboots the system at a specified time
- halt Shuts down the system immediately
- reboot Reboots the system immediately
Compression, Backup and Software in macOS
- compress Compresses files using a Lempel-Ziv algorithm
- gzip Compresses files using a standard Lempel-Ziv algorithm
- bzip2 Compresses files using a block-sorting algorithm
- tar Used to create small tar archives and tarballs
- cpio Used to create full filesystem backups using a variety of options
- make Manages software compiling using gcc and Makefile settings
- gcc The GNU C compiler used to compile software
BASH Management in macOS
As in Linux, macOS stores its variables in environment files. The /etc/profile and /etc/bashrc files are used by default on the system. Each user can also create their own ~/.bash_profile and ~/.bashrc files. In addition, ~/.bash_logout may be used to perform tasks at shell exit. Here are more BASH management commands for macOS.
- set Displays all variables in your shell
- env Displays exported variables in your shell
- alias Creates special alias variables
- unalias Removes special alias variables
- export Creates and exports variables
- ulimit Sets BASH limits for users (e.g., maximum number of user processes)
Process Management in macOS
- ps Displays system and user processes (supports BSD-style options only)
- top Displays top processes and system statistics
- kill Sends kill signals to processes by process identification number (PID)
- killall Sends kill signals to processes by name
- jobs Displays background processes
- fg Moves a background process to the foreground
- bg Moves a foreground process to the background
- nice Changes the priority of a process as it is started
- renice Changes the priority of a running process
- at Schedules commands to run at a later time
- atq Views at jobs
- atrm Removes an at job
- crontab Edits user cron tables (used to repetitively schedule commands)
User and Group Administration in macOS
User and group administration differs slightly in macOS from Linux. There are no useradd or userdel commands. Instead, you must use the System Preferences utility to create user accounts properly. User information is stored in a directory database under the /var/db directory. The /etc/shadow file does not exist and the /etc/passwd and /etc/group files exist only to provide information to apps. Petunias basics version alex basics mac os.
- whoami Displays the current user name
- who am i Displays your username and computer information
- groups Displays the current user's group memberships
- id Prints the User ID (UID) and Group IDs (GIDs) for the current user
- chfn Changes the user description used by the finger command
- finger Displays user description information
- chsh Changes the shell for a user account
- passwd Changes the password for the current user (the root user may change other user's passwords by specifying the username as an argument)
- who Displays who is on the system
- w Displays who is on the system and what they are doing
Common Unix Printing System (CUPS) Printing in macOS
- lp Prints a file (lpr is supported for BSD compatibility)
- lpstat Views print jobs and printer status (lpq and lpc are supported for BSD
- compatibility)
- cancel Removes a print job from the print queue (lprm is supported for BSD
- compatibility)
- cupsaccept Allows jobs to enter a print queue
- cupsreject Prevents jobs from entering a print queue
- cupsenable Allows jobs to be sent to the printer from the print queue
- cupsdisable Prevents jobs from leaving the print queue
Network- and Security-Related Commands in macOS
Network devices have different names in macOS. The first ethernet adapter is called en0 (typically wired ethernet), and the second is called en1 (typically wireless ethernet). Ensure that you use System Preferences to change any network parameters, as they are not stored in text files as they are on Linux systems. For example, the /etc/resolv.conf file still exists in macOS and lists DNS servers configured in System Preferences, but it is not used by the system – it is merely there in case an app queries it. The only network-related file that is used actively and may be edited is /etc/hosts (for local host name resolution). Here are more network- and security-related commands in macOS.
- ifconfig Displays and configures TCP/IP network interfaces
- ping Tests connectivity between hosts
- whois Queries domain name registration information
- arp Views and manages the address resolution protocol (ARP) cache
- netstat Views TCP/IP network statistics and the routing table
- route Manages the TCP/IP routing table
- traceroute Traces an IP packet across routers
- hostname Sets the system host name
- host Resolves host names to IP addresses and vice versa
- nslookup Resolves host names to IP addresses and vice versa
- dig Resolves host names to IP addresses and vice versa
- su Switches your user account to another account
- sudo Performs tasks as another user via entries in the /etc/sudoers file
- last Displays a detailed list of previous user logins
- tcpdump Captures packets on a network interface
Ba Snake Mac Os 11
System and Miscellaneous Commands in macOS
- date Displays the current date and time
- exit Exits out of the shell (logout)
- echo argument Displays the argument to the terminal screen
- clear Clears the screen
- uname option Displays system information specified by the option; –a specifies all information
- uptime Lists system statistics and uptime
- cal Lists the calendar for the current month
- banner Prints an ASCII banner
- iostat Displays input/output (I/O) statistics for the system
Now you've got the macOS basics down, and you know the common commands. In the next installment, I'll be discussing apps. Stay tuned!
Round out your IT skillset with CompTIA Linux+.Ba Snake Mac Os Catalina
It took some 30 months, but I'm finally also giving up on my MacBook Pro.
Of course, I'm hardly the first to come to this conclusion. This latest design has been roasted in the beginning for its useless Touch Bar and removal of a hardware Esc key and substantially inferior battery life, but the complaints really started flying once reports of an unreliable keyboard became commonplace, so much so that 2 years later Apple has had to issue a mea culpa on the problem and extend its warranties specifically for the fragile design; I had to take my laptop back to the Apple Store for repairs twice in 2 years for this problem. A couple weeks ago, the laptop started exhibiting another issue—an unreliable cable that's bonded to the display—that Apple has not yet admitted to and thus would cost at least $500 to repair.
For the record, my 2011 17″ MacBook Pro still runs fine and has only needed one repair in its lifetime, a known GPU issue that Apple eventually admitted and paid to fix.
Like most Apple customers disillusioned by this generation of MacBook Pros, I considered switching to a Windows laptop1. To Microsoft's credit, they have upped the game on both Windows hardware (via the Surface line) and software (via continuous and interesting Windows updates) in recent years, and the overall user experience of the operating system is mostly on par with Macs and MacOS. Hell, I was sorely tempted to make the trade only 10 months ago.
I ended up with replacing my MacBook Pro clunker with an iMac.
As I lamented in the past, MacOS can still lean on a soft lock-in via its software ecosystem. In some cases it's enabled by Apple's iOS <-> Mac connection, but even there Microsoft has done a great job of executing its current strategy of making its software available on all platforms. With desktop computing, web apps have become the de facto platform, and while Windows will have to support its legacy desktop APIs and tech stacks2, they are encouraging the use of web technologies for the OS and rewriting parts of the traditional Office suite in a similar vein. For the rest, Electron-powered apps and Progressive Web Apps make up a substantial chunk of modern Windows applications.
To be fair, web apps—wrapped or otherwise—also make up a lot of the MacOS app ecosystem. The difference, though, is that MacOS (and OSX, before the rebranding) has traditionally had a community of indie app developers who have and are continuing to build for the OS, in native Objective C and/or Swift, with an eye towards great aesthetics and fantastic user experiences. Tweetbot (Twitter client), Reeder (RSS Reader), Fantastical (Calendar), Things (to-do list), Airmail (email client) — there are plenty of web-based equivalents that feature the same set of functionality3, but few that can provide the same end-user experience polish.
The MacOS app ecosystem is also showing that the endgame for desktop apps is paying for software, via subscription or a modest one-time purchase4. While there are certainly a variety of business models possible with software—Software as a Service (SaaS); ad-supported; as a value-add to a customer bundle (e.g., Amazon Prime); to sell hardware; as a loss-leader to other profitable services—desktop apps have retreated to this singular method of monetization: the simple sale.
The lack of monetization options is largely due to the combination of the lack of reach of the desktop as a platform for apps coupled with the overall quality and complexity expected out of these apps, particularly on the Mac. The mobile ecosystem dwarfs any amount of users and usage on laptops and desktops, so most business models which benefit from scale will primarily focus on phones. Utility and productivity software better fit for keyboards and mice still benefit from being on as many platforms as possible, hence Electron and web apps that can span Windows, Macs and Linux workstations along with web browsers.
It leaves the space of quality Mac desktop software as a niche of an already niche corner of computing devices. Since the expected sales are so low anyway, indie app devs have concluded that they might as well just charge money; at least the accounting is easy. Even then, the number of copies sold is so low that the teams behind these apps can't afford to hire huge teams of developers, which in turn affects how feature-rich these apps can be and their pace of evolution.
The upcoming Catalyst initiative—to cross-build iOS and MacOS apps—may very well close the book on native desktop app development. It's still native code, but the UI paradigms are different enough between phones and PCs that much of the uniqueness of the Mac interface gets lost in translation5. And even if indie devs continue to invest in each platform separately, they'll still face added competition from formerly iOS-only apps, which will be just good enough to entice some users, and likely drive down app prices, which in turn makes those businesses unviable.
A requiem, then.
I didn't seriously think about Linux nor Chromebooks as possibilities, when the vast majority of PC desktop and web software assume a Windows or Mac OS.↩
They still let you tap the Win32 API directly if you really need that functionality!↩
In fact, Gmail is so complicated and UI/feature-rich that there is a subindustry of email clients that just wrap around the Gmail web interface and layer a couple of additional features on top.↩
Modest, at least compared to the rock-bottom pricing that plagues mobile app stores.↩
The new Reeder 4 app unified its iOS and Mac codebases, and while the app is still extremely beautiful and functional, there are concessions on the edges made on the desktop to accommodate its mobile cousin.↩ Smashball mac os.