Secrets Mac OS
Secrets Mac OS
As far as the classic Mac OS is concerned, a user is a user is a user. But the Unix core of Mac OS X introduces different user levels. At the top of the heap in every Unix system is a single, all-powerful superuser –also named root (after the topmost directory of the Unix file system). If you have root access, you have ultimate power: you can alter or delete any file or folder in that system.
Macworld Mac Secrets is a good value for the money that will receive plenty of use either as an addition to your library or as a gift. I give this book my highest recommendation, especially for intermediate-level Macintosh users. Macworld Mac Secrets, 4th Edition, David Pogue and Joseph Schorr, ISBN 0-7645-4006-8. $44.95 U.S., $62.99 Canadian. Unlock the macOS Dock’s Hidden Secrets in Terminal. Posted on February 16th, 2021 by Craig Grannell and Kirk McElhearn. Elsewhere on this blog, we help you get to know your Mac’s Dock and discover its many options. But it turns out Apple only provides settings for some of the Dock’s tricks; many are effectively hidden secrets.
Why Root Access?
First, let’s back up for a minute. A user who is designated as an administrator can adjust system preferences (such as the network address), update the OS, and roam almost unhindered throughout that system.
But sometimes almost doesn’t cut it. For Unix omnipotence, you want to act as root. For example, you may want to adjust some settings that Apple put out of the reach of administrators–such as some system-configuration files or the built-in Apache Web server (see Mac OS X Secrets, August 2001). Or perhaps you want to install some Unix software before Aqua-friendly installers become available. Or maybe you just can’t stand not having absolute control over your operating system.
Whatever your reasons, root access is only a few short commands away.
Words of Caution
Apple doesn’t tell you how to enable your root account in OS X–for good reason. As root, you can delete your entire file system in fewer than ten keystrokes. And logging in to your root account opens up your system to the security vulnerability inherent in any Unix system. If someone cracks your root password, for example, your machine can be taken over remotely. But if your root account is not enabled in the first place–as in the default Mac OS X installation–there’s a much smaller chance of that happening.
Some Mac users may think they need to enable their Mac OS X machine’s root account to do anything serious, but that’s just not true. We will show you an alternative that allows you to act as root while keeping your root account disabled, thus protecting against typical network-based attacks.
But root access–even if you don’t enable the root account–is risky. To see where you can do the most damage when you gain root access, enter this command in Terminal: ls /. You’ll see the folders in the root directory of the file system, including the same folders that you see via the Finder: Applications, Library, System, and Users. But you can also see directories that the Finder does not show, such as bin, etc, and usr. As the superuser, you could recklessly delete files in these hidden directories, unwittingly circumventing the file-access permissions that would otherwise keep you from harming them. Damaging these files can wreak havoc with your system, potentially even keeping it from booting up. And in Unix, there is no undo command.
Using the Sudo Command
If your Mac is using a firmware password, you're prompted to enter the password. Option (⌥) or Alt: Start up to Startup Manager, which allows you to choose other available startup disks or volumes. If your Mac is using a firmware password, you're prompted to enter the password. Option-Command-P-R: Reset NVRAM or PRAM.
The Unix directive you need to execute commands as root is sudo (pronounced soo -doo), which stands for “superuser do.” (Type man sudo in the command line to read more information about sudo than you’ll ever need.) To use sudo, you must be logged in as an administrator of the system.
To execute a single command as the superuser, insert sudo and a space in the command line, before the Unix command that you want to issue. For example, you can use this command to make user jsmith the owner of the file test.html:
sudo chown jsmith test.html
When you invoke sudo, you’ll be asked for a password. Enter the password for your administrator account. Even though you’re already logged in as that user, you need to enter your password again (for security reasons). Once you’ve done so, you have a short time (five minutes by default) during which you can issue other commands using sudo without having to reenter a password.
When issuing a series of commands as root, you might get tired of repeatedly entering sudo. Or perhaps you want to run a shell script–a file that, when executed by root, issues a series of Unix commands. You can get root access for as long as you like by invoking sudo -s. To end a superuser session before the power goes to your head, type exit.
Example: Run CGI Sample Scripts
Now you’ll want to try out your superuser status. Let’s say you want to run the two CGI scripts, printenv and test-cgi, that Apple includes with OS X for use with Apache. However, as installed, they don’t work because the file permissions are set incorrectly. To briefly explain, Apache is con-figured to run CGI scripts that are stored in the folder /Library/WebServer/CGI-Executables, as long as the script files are marked as executable (the demo script files aren’t). To reset these permissions, issue the following consecutive commands in Terminal:
cd /Library/WebServer/CGI-Executables
sudo chmod a+x printenv test-cgi
Assuming that you’ve turned Web sharing on via the Sharing panel of System Preferences, you can now run the two sample CGI scripts by entering these URLs in your Web browser:
http://localhost/cgi-bin/printenv
http://localhost/cgi-bin/test-cgi
Example: Edit Message of the Day
You may also need to assume the mantle of superuser to edit files in the usr, bin, etc, and other hidden directories, but you alter them at your own risk. When you’re ready to try it out, one file you can edit with some degree of abandon is the message of the day file in /etc/motd, which is accessible via the command line. The message of the day appears when a remote user logs in to your system from a terminal interface. By default, the Mac OS X message of the day is “Welcome to Darwin!”
To make that message a little more exciting, you can edit /etc/motd with a Unix editor such as pico or vi. The command vi /etc/motd or pico /etc/motd will let you open the file only as read-only. However, if you “sudo” the editing command, you’ll be able to save a more informative message, such as “Welcome to Dave’s Mac OS X. The system will be down tomorrow for maintenance.”
To edit the message of the day or other Unix preferences files via TextEdit instead of pico or vi, drag the TextEdit icon on top of the icon for the shareware application Pseudo ($15; personalpages.tds.net/~brian_hill/pseudo.html ). You can find more information about Pseudo in “Mac OS X First Aid,” elsewhere in this issue.
Example: Install Unix Software
Finally, here’s a more complex situation: installing Unix software for which a complete, user-friendly Aqua installer has not yet been created. Perhaps you want to install the free MySQL database to go along with your Apache Web server. There isn’t a Mac OS X-compiled version available for download from the MySQL Web site, but a Web search turns up (among other choices) Marc Liyanage’s Web page ( www.entropy.ch/software/macosx ), where you can download MySQL compiled for Mac OS X.
Without root access, it is impossible to install this piece of software. An Aqua installer handles most of the dirty work, but the instructions do call for a handful of commands to be run with sudo. (The commands are listed on Liyanage’s Web page.)
The Bottom Line
There is rarely a need, or a good reason, for OS X users-even those who have above-average skills–to enable the root account. In fact, there are excellent reasons not to enable it–especially since the sudo command allows you to wield the power of root access throughout your system.As our examples demonstrate, sudo gives you the ability to configure (or confound) Mac OS X at its most fundamental level.
Mac Os Secrets
DAVID L. HART is a science and technology writer and the author of Mac OS X Web Server Handbook (Prentice Hall PTR, 2001) and The Cross-Platform Mac Handbook (Prentice Hall PTR, 2000).
The Root of the Matter: By typing ls / at the command-line prompt, you can see a list of the folders at your machine’s root level (you can’t seem them via the Finder) and change permissions using sudo.The Messages app on your iPhone, iPad and Mac is obviously used for sending an iMessage or SMS messages to other people. That’s just the beginning. You might not have noticed some special features. That’s a shame, because you’re missing out on some powerful options.
Find Someone’s Location
Find My Friends has been around since iOS 6. Until El Capitan, the Mac OS hasn’t had a dedicated way of accessing someone’s location. That’s because it’s been under Details in Messages. To use this feature the person has to agree to share their location with you.
On any Apple device running Messages, clicking or tapping
This works nearly identically in iOS and Mac OS. In iOS, it will show your location relative to that contact. With iOS, if you want to share your location with that person, select
Get Contact Information
Instead of opening Contacts and searching for the person, just find a message from that contact. In iOS, after tapping Details, tap the circled i icon. That brings up the card for the contact. On the Mac, right click on the name in Messages and select Show Contact Card.
Do Not Disturb
If one contact is bothering you when you’re trying to get work done (sorry Mom), you can essentially mute just that person. The messages go through, you just won’t get notifications they sent you via messages. This feature works the same on iOS and Mac OS.
Start a FaceTime Chat
Text messages and emoji don’t always help you communicate. Sometimes your voice and face help you express yourself. Instead of switching apps, you can start a Facetime session in iOS or Mac OS directly from the Messages application.
Watch your Data: FaceTime could eat up your data plan, so check out our guide on how to track your usage.For FaceTime Audio, select the picture of the phone receiver. On an iPhone, if you tap the picture of the phone receiver, you’ll get the choice of FaceTime Audio or a Voice Call. If you’d like to add video, select the camera icon to start a video chat session.
Manage Pictures Sent From that Contact
Pictures people send you from Messages aren’t automatically saved to your pictures. Instead of scrolling up in a conversation trying to remember when the picture was sent, scroll down a bit in details. If that contact sent you a pic, all those pictures will be there. Tap or select a picture and you’ll get a few options. In iOS, you can copy it (great for sharing the picture in another conversation), delete it (that’s a great way to clear up some space on your iPhone or iPad ) or you can save it. The options in Mac OS are similar: Open, Add to Photos Library, or Delete.
It works for attachments too: when I lose an attachment, I know I can always find it again in Messages.Secret Macos Commands
Mac OS: Start a Remote Control Session
This feature only works if both parties are running Yosemite or above. You’ll notice the standard Mac screen sharing icons in the Details tab. Click on that icon. You’ll either invite the person to share your screen or you’ll ask to share their screen. This trick is handy if the other person is non-technical and may not be able to find the Apple screen sharing app. All they need to do is wait for your request in Messages. Sadly, this doesn’t work between Mac OS and iOS.
Want cross-platform remote control? we have some apps that do support cross-platform remote control.Apple continues to add great features to the Messages app, so keep your eye open for even more features in Mac OS and iOS.
The above article may contain affiliate links which help support Guiding Tech. However, it does not affect our editorial integrity. The content remains unbiased and authentic.
Read Next
Top 3 Fixes for Messages App Missing Issue on iPhone and iPad
Can't find the Messages app on your
Secrets Mac OS