To use any of these key combinations, press and hold the keys immediately after pressing the power button to turn on your Mac, or after your Mac begins to restart. Keep holding until the described behavior occurs.
May 19, 2020 Can someone help me on How to create a desktop shortcut file with command line arguments on MAC I need to pass some arguments to.app file which is under Applications folder. I tried to create a shell script for that and created a shortcut. But the issue is unable to launch the application when I implemented that in my package. In OS X 10.6, the open command was enhanced to allow passing of arguments to the application: open./AppName.app -args -AppCommandLineArg But for older versions of Mac OS X, and because app bundles aren't designed to be passed command line arguments, the conventional mechanism is to use Apple Events for files like here for Cocoa apps or here.
- Command (⌘)-R: Start up from the built-in macOS Recovery system. Or use Option-Command-R or Shift-Option-Command-R to start up from macOS Recovery over the Internet. macOS Recovery installs different versions of macOS, depending on the key combination you use while starting up. 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. If your Mac is using a firmware password, it ignores this key combination or starts up from macOS Recovery.
- Shift (⇧): Start up in safe mode. Disabled when using a firmware password.
- D: Start up to the Apple Diagnostics utility. Or use Option-Dto start up to this utility over the Internet. Disabled when using a firmware password.
- N: Start up from a NetBoot server, if your Mac supports network startup volumes. To use the default boot image on the server, hold down Option-N instead. Disabled when using a firmware password.
- Command-S: Start up in single-user mode. Disabled in macOS Mojave or later, or when using a firmware password.
- T: Start up in target disk mode. Disabled when using a firmware password.
- Command-V: Start up in verbose mode. Disabled when using a firmware password.
- Eject (⏏) or F12 or mouse button or trackpad button: Eject removable media, such as an optical disc. Disabled when using a firmware password.
If a key combination doesn't work
If a key combination doesn't work at startup, one of these these solutions might help:
- Be sure to press and hold all keys in the combination together, not one at a time.
- Shut down your Mac. Then press the power button to turn on your Mac. Then press and hold the keys as your Mac starts up.
- Wait a few seconds before pressing the keys, to give your Mac more time to recognize the keyboard as it starts up. Some keyboards have a light that flashes briefly at startup, indicating that the keyboard is recognized and ready for use.
- If you're using a wireless keyboard, plug it into your Mac, if possible. Or use your built-in keyboard or a wired keyboard. If you're using a keyboard made for a PC, such as a keyboard with a Windows logo, try a keyboard made for Mac.
- If you're using Boot Camp to start up from Microsoft Windows, set Startup Disk preferences to start up from macOS instead. Then shut down or restart and try again.
Remember that some key combinations are disabled when your Mac is using a firmware password.
- Learn what to do if your Mac doesn't turn on.
- Learn about Mac keyboard shortcuts that you can use after your Mac has started up.
Very often, in OS X, when one has a terminal command that needs to be used often, it's convenient to turn that UNIX command into a double-clickable desktop file with a recognizable icon. How can that possibly be done? I'll show you how.
OS X is based on BSD UNIX
Here's the basic outline of this tip.
- Create a UNIX script with a text editor that contains one or more terminal commands.
- Make it executable.
- Double click it in the Finder.
It's really quite simple, but there are a few things to be aware of. I'll walk you through it and add some notes as needed.
I. Create a script. UNIX scripts are similar to AppleScript. There are commands and a syntax. From time to time you'll see articles that show how to change an OS X preference from the command line. For example, you may have seen this terminal command that strips the drop shadow from your screenshots:
Note #1. The Terminal app location is /Applications/Utilities/Terminal.app
Scripts are a sequence of commands, managed by the scripting language, to a achieve a task. The easiest way to write a script is to use a text editor, like OS X's built-in TextEdit, found in the Applications folder.
Note #2. Make sure the Preferences for TextEdit are set correctly. Preferences > New Document > Plain text. Once set, relaunch TextEdit.
Here's a simple script that uses the 'uptime' command to display how long it's been since your Mac was rebooted.
Note #3. The first line tells OS X to use the Bash scripting language. There are several to chose from. We won't dig into that here.
Copy and paste this script into a new TextEdit file. Call it 'ByYourCommand.txt' Save this file on your desktop.
II. Make the Script Executable.
1. In the Finder, delete the file extension '.txt' The Finder will ask for confirmation.
2. Open the Terminal app and navigate to the file. Substitute your own login name instead of mine. Like this:
Mac Os Command Line Tools
3. Still in the terminal, execute this UNIX command:
Mac Os X Launch App Command Line System
Note #4. This UNIX command makes the file executable, that is, double-clickable.
Note #5. If you have antivirus software installed, it may object, depending on its preferences, to an executable script being inserted into a file that was created by an OS X text editor. Just ignore the warning.
At this point, you'll notice that the file's icon has changed to this:
III. Double click the file 'ByYourCommand' on the desktop. The Terminal app will launch, the script will be executed, and you'll see the results, like this:
Dj app spotify mac free. Uptime: one day, 21 h since my last reboot.
If you need to edit the script, you'll have to add the '.txt' extension back. (Or, as the geeks will point out, edit with a UNIX editor like vi. I had to say that.)
This is as far as we'll go with a one line command. Once you get the hang of this and learn a whole lot more, you'll find yourself happily creating your own custom scripts—if you decide to learn Bash or one of the other UNIX shells available. A new door is open to create your own scripts, but you should, of course, learn much more about UNIX and scripting before you go wild with this newfound superpower. A really careless act could render your OS X corrupted and/or unbootable.