Mac How To Run App On Command Line

Run a command such as the following to rebuild the app and view it within a specific platform's emulator: $ cordova emulate android Following up with the cordova emulate command refreshes the emulator image to display the latest application, which is now available for launch from the home screen. The Android SDK is composed of multiple packages that are required for app development. This page lists the most important command line tools that are available, organized by the packages in which they're delivered. Question: Q: Windows 'Run' Command on a Mac. Oh, and while not equivalent, the Terminal application allows you access to the unix command line. Its command-line tools include Git in the package. Users who don’t have Xcode can install it with a single command: xcode-select -install. With Xcode running on your Mac, you can check whether Git is also available by prompting for the Git version: git -version. The output should display the latest Git release, as in the example below.

If you trust the app, click “Open” to run it. Your Mac will remember this setting for each specific app you allow to run, and you won’t be asked again the next time you run that app. You’ll just have to do this the first time you want to run a new unsigned app. This is the best, most secure way to run a handful of unsigned. How to open terminal on mac. As you know MacOS runs on Unix and sometimes there is a requirement to run commands through mac terminal. Let's Find out how to.

Technical Note TN2339

This document provides answers to frequently asked questions about command line tools.

What is the Command Line Tools Package?

The Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS. It consists of the macOS SDK and command-line tools such as Clang, which are installed in the /Library/Developer/CommandLineTools directory.

Downloading command-line tools is not available in Xcode for macOS 10.9. How can I install them on my machine?

In macOS 10.9 and later, the Downloads pane of Xcode Preferences does not support downloading command-line tools. Use any of the following methods to install command-line tools on your system:

  • Install Xcode

    If Xcode is installed on your machine, then there is no need to install them. Xcode comes bundled with all your command-line tools. macOS 10.9 and later includes shims or wrapper executables. These shims, installed in /usr/bin, can map any tool included in /usr/bin to the corresponding one inside Xcode. xcrun is one of such shims, which allows you to find or run any tool inside Xcode from the command line. Use it to invoke any tool within Xcode from the command line as shown in Listing 1.


    Listing 1 Using xcrun to run dwarfdump in the Terminal application.

  • Download the Command Line Tools package from the Developer website

    The Command Line Tools package is available for download on the Download for Apple Developers page. Log in with your Apple ID, then search and download the Command Line Tools package appropriate for your machine such as macOS 10.12 as shown in Figure 1.

Note: In macOS 10.9 and later, Software update notifies you when new versions of the command-line tools are available for update.

  • Install the Command Line Tools package via the Terminal application

    You can install the Command Line Tools package by running the xcode-select --install command.

    Note: macOS comes bundled with xcode-select, a command-line tool that is installed in /usr/bin. It allows you to manage the active developer directory for Xcode and other BSD development tools. See its man page for more information.

How can I uninstall the command-line tools?

  • Xcode includes all of the command-line tools. If it is installed on your system, remove it to uninstall the command-line tools.

  • If the /Library/Developer/CommandLineTools directory exists on your system, remove it to uninstall the command-line tools.

I have multiple versions of Xcode installed on my machine. What version of Xcode do the command-line tools currently use?

To find out what version of Xcode is being used by your tools, run the following command in Terminal:

Listing 2 Printing the version of Xcode currently used by the command-line tools.

How do I select the default version of Xcode to use for my command-line tools?

To select a default Xcode for your command-line tools, run the following command in Terminal:

where <path/to/> is the path to the Xcode.app package you wish to use for development.

Listing 3 Setting the default Xcode version.

How do I build my projects from the command line?

xcodebuild is a command-line tool that allows you to perform build, query, analyze, test, and archive operations on your Xcode projects and workspaces from the command line. It operates on one or more targets contained in your project, or a scheme contained in your project or workspace. xcodebuild provides several options for performing these operations as seen its man page. xcodebuild saves the output of your commands in the locations defined in the Locations preferences pane of your Xcode application, by default.

See below for various xcodebuild usage. Be sure to navigate to the directory containing your project or workspace in Terminal before running any of the following commands.

  • To list all schemes in your workspace, run the following command in Terminal:

    where <your_workspace_name> is the name of your workspace.


    Listing 4 Listing all schemes in the MyApplication workspace.

  • To list all targets, build configurations, and schemes used in your project, run the following command in Terminal:

    where <your_project_name> is the name of your project.


    Listing 5 Listing all information about MyProject, an Xcode project.

  • To build a scheme in your project, run the following command in Terminal:

    where <your_scheme_name> and build are respectively the name of your scheme to be built and the action to be performed on your scheme.


    Listing 6 Building the tvOS scheme.

    Note: xcodebuild supports various build actions such as build, analyze, and archive that can be performed on your target or scheme. However, build is performed by default when no action is specified as shown in Listing 7.

  • To build your target with a configuration file, run the following command in Terminal:

    where <your_target_name> and <your_configuration_file> are respectively the name of your target to be built and the name of your configuration file. See Xcode Help's Build configuration file reference for more information about xcconfig files.


    Listing 7 Building the iOS target with a configuration file.

  • To change the output locations of your xcodebuild command, use the SYMROOT (Build Products Path) and DSTROOT (Installation Build Products Location) build settings that respectively specify a location for your debug products and .dSYM files and one for your released products. See Xcode Help's Build setting reference for more information about these build settings.


    Listing 8 Setting up a location for iOS' debug app version.


    Listing 9 Setting up a location for iOS's released app version.

My app has multiple build configurations. How do I set a default build configuration for xcodebuild?

In Xcode, the Configurations section of your project's Info pane provides a pop-up menu, which sets the default configuration to be used by xcodebuild when building a target. Use this pop-up menu to select a default build configuration for xcodebuild as seen in Figure 2.

How do I run unit tests from the command line?

xcodebuild provides several options for running unit tests.

To build and run unit tests from the command line, execute the following command in Terminal:

To build unit tests without running them from the command line, execute the following command in Terminal:

To run unit tests without building them from the command line, execute any of the following command in Terminal:

The test action requires specifying a scheme and a destination. See How do I implement the Build For Testing and Test Without Building features from the command line? for more information about build-for-testing and test-without-building actions.

The -workspace option allows you to specify the name of your workspace. Use this option when your scheme is contained in an Xcode workspace.

The -project option allows you to specify the name of your Xcode project. Use this option when your scheme is contained in an Xcode project. It is required when there are multiple Xcode projects in the same directory and optional, otherwise.

The -destination option allows you to specify a destination for your unit tests. It takes an argument <destination-specifier>, which describes the device, simulator, or Mac to use as a destination. It consists of a set of comma-separated key=value pairs, which are dependent upon the the device, simulator, or Mac being used.

The -only-testing and -skip-testing options, which are optional, allow you to run only a specific test and to skip a test, respectively. They take an argument <test-identifier>, which specifies the test to be executed or excluded. test-identifier's format is as follows:

Line

TestTarget, which is required, is the name of the test bundle. TestClass and TestMethod, which are both optional, respectively represent the name of the class and the name of the method to be tested.

Note: See Xcode Scheme and Run your app in Simulator for more information about scheme and destination, respectively.

  • For macOS apps, destinationspecifier supports the platform and arch keys as seen in Table 1. Both keys are required for running your unit tests in macOS.

    Table 1 Supported keys for macOS apps.

    Key

    Description

    Value

    platform

    The supported destination for your unit tests.

    macOS

    arch

    The architecture to use to run your unit tests.

    i386 or x86_64

    See Listing 10 for an example that tests a scheme in macOS and where destinationspecifier is set to 'platform=macOS,arch=x86_64'.


    Listing 10 Tests the macOS scheme for 64-bit in macOS.

  • For iOS and tvOS apps, destinationspecifier supports the platform, name, and id keys as seen in Table 2.

    Table 2 Supported keys for iOS and tvOS apps.

    Key

    Description

    Value

    platform

    The supported destination for your unit tests.

    iOS (for iOS apps)tvOS (for tvOS apps)

    name

    The full name of your device to be used for your unit tests.

    The name of your device as displayed in the Devices Organizer in Xcode.

    id

    The identifier of your device to be used for your unit tests.

    See Locate a device identifier for more information about getting your device identifier.

    The name and id keys are intergeably used with platform, which is a required key as seen in Listing 11 and Listing 12.


    Listing 11 Tests the iOS scheme on a device identified by 965058a1c30d845d0dcec81cd6b908650a0d701c.


    Listing 12 Testing the iOSApp scheme on an iPhone.


    Listing 13 Do not test iOSAppUITests on an iPhone.


    Listing 14 Only testing SecondTestClass' testExampleB in the iOSAppTests unit test.

  • For iOS Simulator and tvOS Simulator apps, destinationspecifier supports the platform, name, id, and OS keys as seen in Table 3.

    Table 3 Supported keys for iOS Simulator and tvOS Simulator apps.

    Key

    Description

    Value

    platform

    The supported destination for your unit tests.

    iOS Simulator (iOS apps)tvOS Simulator (tvOS apps)

    name

    The full name of the simulator (iOS simulator for iOS apps and tvOS Simulator for tvOS apps) to be used for your unit tests and as displayed in the run destination of your Xcode project.

    The name of your device as displayed in the Devices Organizer in Xcode.

    id

    The identifier of your device to be used for your unit tests.

    See Locate a device identifier for more information about getting your device identifier.

    OS

    The version of iOS or tvOS to simulate such as 9.0 or the string latest to indicate the most recent version of iOS supported by your version of Xcode.

    An iOS version, tvOS version, or latest

    The name and id keys are intergeably used with platform, which is a required key as shown in Listing 15 and Listing 16. The OS key is optional.


    Listing 15 Tests the iOS scheme on an iPad Pro (12.9 inch) with iOS 10.2 in the Simulator.


    Listing 16 Tests the tvOS scheme on an tvOS Simulator identified by D6FA2C2A-E297-406A-AA22-624B4834ACB2.

The -destination option also allows you to run the same unit test on multiple destinations. This is done by adding it multiple times to your xcodebuild test command as demonstrated in Listing 17.

Listing 17 Tests the iOS scheme in both the Simulator and on an iPod touch.

Mac Command Line Tutorial

Note: xcodebuild runs your tests sequentially. For instance In Listing 17, xcodebuild will first test iOS in the Simulator before executing it on the iPod touch.

How do I implement the Build For Testing and Test Without Building features from the command line?

  • xcodebuild provides the build-for-testing action for Xcode's Product > Build For > Testing feature. You must specify a scheme to use it. To use it, execute the following command in Terminal:

    See How do I run unit tests from the command line? for more information about xcodebuild build-for-testing's options.


    Listing 18 Builds tests and associated targets in the tvOS scheme using the tvOS Simulator identified by D6FA2C2A-E297-406A-AA22-624B4834ACB2.

    build-for-testing generates an xctestrun file, which is saved in the derived data folder. See xcodebuild.xctestrun's man page for more information about xctestrun files.

  • xcodebuild provides the test-without-building action for Xcode's Product > Perform Action > Test Without Building feature. test-without-building requires that you specify either a scheme or an xctestrun file.

    • Usage when using a scheme

      See How do I run unit tests from the command line? for more information about xcodebuild test-without-building's options.

      Important: When using a scheme, test-without-building searches for bundles in the build root (SYMROOT). Therefore, be sure to build your target or that your build root includes the bundles to be tested before running this command. See Xcode Help's Build settings reference for more information about SYMROOT.


      Listing 19 Tests the iOSApp scheme on an iPhone SE with iOS 10.1 in the Simulator.

    • Usage when using an xctestrun file

      where <your_xctestrun_name> is the name of the file containing your test run parameters. See xcodebuild.xctestrun' s man page for more information about xctestrun files. See How do I run unit tests from the command line? for more information about the other options.

      Important: When using an xctestrun file, test-without-building searches for bundles at paths specified in the file. Therefore, be sure that the bundles exist at the specified paths before running this command.


      Listing 20 Testing bundles and other parameters specified in iOSApp_iphonesimulator.xctestrun using the iOS Simulator identified by 6DC4A7BA-EA7F-40D6-A327-A0A9DF82F7F6.


      Listing 21 Tests everything but iOSAppUITests specified in iOSApp_iphonesimulator.xctestrun using the iOS Simulator identified by 3D95DF14-E8B7-4A05-B65B-78F381B74B22.

Note:build-for-testing and test-without-building provide support for continuous integration systems.

What keys can I pass to the exportOptionsPlist flag?

To get all available keys for -exportOptionsPlist, run the following command in Terminal:

Listing 22 Fetching all keys supported by -exportOptionsPlist.

See Figure 3 for a sample file that contains some options for the -exportOptionsPlist flag.

How do I archive and export my app for distribution?

To archive and export your app for distribution, run the following command in Terminal:

where <xcarchivepath> specifies the archive or the path of the archive to be exported, <destinationpath> specifies where to save the exported product, and <path> is the path to the file with a list of options for the -exportOptionsPlist flag.

Listing 23 Exports the iOSApp archive to the Release location with the options saved in the OptionsPlist.plist.


Document Revision History


DateNotes
2017-06-19

Updated the 'How do I run unit tests from the command line?' question.Added the 'How do I implement the Build For Testing and Test Without Building features from the command line?' and 'What keys can I pass to the exportOptionsPlist flag?' questions.

Updated the 'How do I run unit tests from the command line?' question.Added the 'How do I implement the Build For Testing and Test Without Building features from the command line?' and 'What keys can I pass to the exportOptionsPlist flag?' questions.

2014-05-21

New document that provides answers to frequently asked questions about command-line tools.




Command Line On Mac

Copyright © 2017 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2017-06-19

To use a keyboard shortcut, press and hold one or more modifier keys and then press the last key of the shortcut. For example, to use Command-C (copy), press and hold the Command key, then the C key, then release both keys. Mac menus and keyboards often use symbols for certain keys, including modifier keys:


On keyboards made for Windows PCs, use the Alt key instead of Option, and the Windows logo key instead of Command.

Some keys on some Apple keyboards have special symbols and functions, such as for display brightness , keyboard brightness , Mission Control, and more. If these functions aren't available on your keyboard, you might be able to reproduce some of them by creating your own keyboard shortcuts. To use these keys as F1, F2, F3, or other standard function keys, combine them with the Fn key.

Cut, copy, paste, and other common shortcuts

  • Command-X: Cut the selected item and copy it to the Clipboard.
  • Command-C: Copy the selected item to the Clipboard. This also works for files in the Finder.
  • Command-V: Paste the contents of the Clipboard into the current document or app. This also works for files in the Finder.
  • Command-Z: Undo the previous command. You can then press Shift-Command-Z to Redo, reversing the undo command. In some apps, you can undo and redo multiple commands.
  • Command-A: Select All items.
  • Command-F: Find items in a document or open a Find window.
  • Command-G: Find Again: Find the next occurrence of the item previously found. To find the previous occurrence, press Shift-Command-G.
  • Command-H: Hide the windows of the front app. To view the front app but hide all other apps, press Option-Command-H.
  • Command-M: Minimize the front window to the Dock. To minimize all windows of the front app, press Option-Command-M.
  • Command-O: Open the selected item, or open a dialog to select a file to open.
  • Command-P: Print the current document.
  • Command-S: Save the current document.
  • Command-T: Open a new tab.
  • Command-W: Close the front window. To close all windows of the app, press Option-Command-W.
  • Option-Command-Esc: Force quit an app.
  • Command–Space bar: Show or hide the Spotlight search field. To perform a Spotlight search from a Finder window, press Command–Option–Space bar. (If you use multiple input sources to type in different languages, these shortcuts change input sources instead of showing Spotlight. Learn how to change a conflicting keyboard shortcut.)
  • Control–Command–Space bar: Show the Character Viewer, from which you can choose emoji and other symbols.
  • Control-Command-F: Use the app in full screen, if supported by the app.
  • Space bar: Use Quick Look to preview the selected item.
  • Command-Tab: Switch to the next most recently used app among your open apps.
  • Shift-Command-5: In macOS Mojave or later, take a screenshot or make a screen recording. Or use Shift-Command-3 or Shift-Command-4 for screenshots. Learn more about screenshots.
  • Shift-Command-N: Create a new folder in the Finder.
  • Command-Comma (,): Open preferences for the front app.

Sleep, log out, and shut down shortcuts

You might need to press and hold some of these shortcuts for slightly longer than other shortcuts. This helps you to avoid using them unintentionally.

  • Power button: Press to turn on your Mac or wake it from sleep. Press and hold for 1.5 seconds to put your Mac to sleep.* Continue holding to force your Mac to turn off.
  • Option–Command–Power button* or Option–Command–Media Eject : Put your Mac to sleep.
  • Control–Shift–Power button* or Control–Shift–Media Eject : Put your displays to sleep.
  • Control–Power button* or Control–Media Eject : Display a dialog asking whether you want to restart, sleep, or shut down.
  • Control–Command–Power button:* Force your Mac to restart, without prompting to save any open and unsaved documents.
  • Control–Command–Media Eject : Quit all apps, then restart your Mac. If any open documents have unsaved changes, you will be asked whether you want to save them.
  • Control–Option–Command–Power button* or Control–Option–Command–Media Eject : Quit all apps, then shut down your Mac. If any open documents have unsaved changes, you will be asked whether you want to save them.
  • Control-Command-Q: Immediately lock your screen.
  • Shift-Command-Q: Log out of your macOS user account. You will be asked to confirm. To log out immediately without confirming, press Option-Shift-Command-Q.

* Does not apply to the Touch ID sensor.

Finder and system shortcuts

  • Command-D: Duplicate the selected files.
  • Command-E: Eject the selected disk or volume.
  • Command-F: Start a Spotlight search in the Finder window.
  • Command-I: Show the Get Info window for a selected file.
  • Command-R: (1) When an alias is selected in the Finder: show the original file for the selected alias. (2) In some apps, such as Calendar or Safari, refresh or reload the page. (3) In Software Update preferences, check for software updates again.
  • Shift-Command-C: Open the Computer window.
  • Shift-Command-D: Open the desktop folder.
  • Shift-Command-F: Open the Recents window, showing all of the files you viewed or changed recently.
  • Shift-Command-G: Open a Go to Folder window.
  • Shift-Command-H: Open the Home folder of the current macOS user account.
  • Shift-Command-I: Open iCloud Drive.
  • Shift-Command-K: Open the Network window.
  • Option-Command-L: Open the Downloads folder.
  • Shift-Command-N: Create a new folder.
  • Shift-Command-O: Open the Documents folder.
  • Shift-Command-P: Show or hide the Preview pane in Finder windows.
  • Shift-Command-R: Open the AirDrop window.
  • Shift-Command-T: Show or hide the tab bar in Finder windows.
  • Control-Shift-Command-T: Add selected Finder item to the Dock (OS X Mavericks or later)
  • Shift-Command-U: Open the Utilities folder.
  • Option-Command-D: Show or hide the Dock.
  • Control-Command-T: Add the selected item to the sidebar (OS X Mavericks or later).
  • Option-Command-P: Hide or show the path bar in Finder windows.
  • Option-Command-S: Hide or show the Sidebar in Finder windows.
  • Command–Slash (/): Hide or show the status bar in Finder windows.
  • Command-J: Show View Options.
  • Command-K: Open the Connect to Server window.
  • Control-Command-A: Make an alias of the selected item.
  • Command-N: Open a new Finder window.
  • Option-Command-N: Create a new Smart Folder.
  • Command-T: Show or hide the tab bar when a single tab is open in the current Finder window.
  • Option-Command-T: Show or hide the toolbar when a single tab is open in the current Finder window.
  • Option-Command-V: Move the files in the Clipboard from their original location to the current location.
  • Command-Y: Use Quick Look to preview the selected files.
  • Option-Command-Y: View a Quick Look slideshow of the selected files.
  • Command-1: View the items in the Finder window as icons.
  • Command-2: View the items in a Finder window as a list.
  • Command-3: View the items in a Finder window in columns.
  • Command-4: View the items in a Finder window in a gallery.
  • Command–Left Bracket ([): Go to the previous folder.
  • Command–Right Bracket (]): Go to the next folder.
  • Command–Up Arrow: Open the folder that contains the current folder.
  • Command–Control–Up Arrow: Open the folder that contains the current folder in a new window.
  • Command–Down Arrow: Open the selected item.
  • Right Arrow: Open the selected folder. This works only when in list view.
  • Left Arrow: Close the selected folder. This works only when in list view.
  • Command-Delete: Move the selected item to the Trash.
  • Shift-Command-Delete: Empty the Trash.
  • Option-Shift-Command-Delete: Empty the Trash without confirmation dialog.
  • Command–Brightness Down: Turn video mirroring on or off when your Mac is connected to more than one display.
  • Option–Brightness Up: Open Displays preferences. This works with either Brightness key.
  • Control–Brightness Up or Control–Brightness Down: Change the brightness of your external display, if supported by your display.
  • Option–Shift–Brightness Up or Option–Shift–Brightness Down: Adjust the display brightness in smaller steps. Add the Control key to this shortcut to make the adjustment on your external display, if supported by your display.
  • Option–Mission Control: Open Mission Control preferences.
  • Command–Mission Control: Show the desktop.
  • Control–Down Arrow: Show all windows of the front app.
  • Option–Volume Up: Open Sound preferences. This works with any of the volume keys.
  • Option–Shift–Volume Up or Option–Shift–Volume Down: Adjust the sound volume in smaller steps.
  • Option–Keyboard Brightness Up: Open Keyboard preferences. This works with either Keyboard Brightness key.
  • Option–Shift–Keyboard Brightness Up or Option–Shift–Keyboard Brightness Down: Adjust the keyboard brightness in smaller steps.
  • Option key while double-clicking: Open the item in a separate window, then close the original window.
  • Command key while double-clicking: Open a folder in a separate tab or window.
  • Command key while dragging to another volume: Move the dragged item to the other volume, instead of copying it.
  • Option key while dragging: Copy the dragged item. The pointer changes while you drag the item.
  • Option-Command while dragging: Make an alias of the dragged item. The pointer changes while you drag the item.
  • Option-click a disclosure triangle: Open all folders within the selected folder. This works only when in list view.
  • Command-click a window title: See the folders that contain the current folder.
  • Learn how to use Command or Shift to select multiple items in the Finder.
  • Click the Go menu in the Finder menu bar to see shortcuts for opening many commonly used folders, such as Applications, Documents, Downloads, Utilities, and iCloud Drive.

Run Mac Apps On Pc

Document shortcuts

The behavior of these shortcuts may vary with the app you're using.

  • Command-B: Boldface the selected text, or turn boldfacing on or off.
  • Command-I: Italicize the selected text, or turn italics on or off.
  • Command-K: Add a web link.
  • Command-U: Underline the selected text, or turn underlining on or off.
  • Command-T: Show or hide the Fonts window.
  • Command-D: Select the Desktop folder from within an Open dialog or Save dialog.
  • Control-Command-D: Show or hide the definition of the selected word.
  • Shift-Command-Colon (:): Display the Spelling and Grammar window.
  • Command-Semicolon (;): Find misspelled words in the document.
  • Option-Delete: Delete the word to the left of the insertion point.
  • Control-H: Delete the character to the left of the insertion point. Or use Delete.
  • Control-D: Delete the character to the right of the insertion point. Or use Fn-Delete.
  • Fn-Delete: Forward delete on keyboards that don't have a Forward Delete key. Or use Control-D.
  • Control-K: Delete the text between the insertion point and the end of the line or paragraph.
  • Fn–Up Arrow: Page Up: Scroll up one page.
  • Fn–Down Arrow: Page Down: Scroll down one page.
  • Fn–Left Arrow: Home: Scroll to the beginning of a document.
  • Fn–Right Arrow: End: Scroll to the end of a document.
  • Command–Up Arrow: Move the insertion point to the beginning of the document.
  • Command–Down Arrow: Move the insertion point to the end of the document.
  • Command–Left Arrow: Move the insertion point to the beginning of the current line.
  • Command–Right Arrow: Move the insertion point to the end of the current line.
  • Option–Left Arrow: Move the insertion point to the beginning of the previous word.
  • Option–Right Arrow: Move the insertion point to the end of the next word.
  • Shift–Command–Up Arrow: Select the text between the insertion point and the beginning of the document.
  • Shift–Command–Down Arrow: Select the text between the insertion point and the end of the document.
  • Shift–Command–Left Arrow: Select the text between the insertion point and the beginning of the current line.
  • Shift–Command–Right Arrow: Select the text between the insertion point and the end of the current line.
  • Shift–Up Arrow: Extend text selection to the nearest character at the same horizontal location on the line above.
  • Shift–Down Arrow: Extend text selection to the nearest character at the same horizontal location on the line below.
  • Shift–Left Arrow: Extend text selection one character to the left.
  • Shift–Right Arrow: Extend text selection one character to the right.
  • Option–Shift–Up Arrow: Extend text selection to the beginning of the current paragraph, then to the beginning of the following paragraph if pressed again.
  • Option–Shift–Down Arrow: Extend text selection to the end of the current paragraph, then to the end of the following paragraph if pressed again.
  • Option–Shift–Left Arrow: Extend text selection to the beginning of the current word, then to the beginning of the following word if pressed again.
  • Option–Shift–Right Arrow: Extend text selection to the end of the current word, then to the end of the following word if pressed again.
  • Control-A: Move to the beginning of the line or paragraph.
  • Control-E: Move to the end of a line or paragraph.
  • Control-F: Move one character forward.
  • Control-B: Move one character backward.
  • Control-L: Center the cursor or selection in the visible area.
  • Control-P: Move up one line.
  • Control-N: Move down one line.
  • Control-O: Insert a new line after the insertion point.
  • Control-T: Swap the character behind the insertion point with the character in front of the insertion point.
  • Command–Left Curly Bracket ({): Left align.
  • Command–Right Curly Bracket (}): Right align.
  • Shift–Command–Vertical bar (|): Center align.
  • Option-Command-F: Go to the search field.
  • Option-Command-T: Show or hide a toolbar in the app.
  • Option-Command-C: Copy Style: Copy the formatting settings of the selected item to the Clipboard.
  • Option-Command-V: Paste Style: Apply the copied style to the selected item.
  • Option-Shift-Command-V: Paste and Match Style: Apply the style of the surrounding content to the item pasted within that content.
  • Option-Command-I: Show or hide the inspector window.
  • Shift-Command-P: Page setup: Display a window for selecting document settings.
  • Shift-Command-S: Display the Save As dialog, or duplicate the current document.
  • Shift–Command–Minus sign (-): Decrease the size of the selected item.
  • Shift–Command–Plus sign (+): Increase the size of the selected item. Command–Equal sign (=) performs the same function.
  • Shift–Command–Question mark (?): Open the Help menu.

Other shortcuts

For more shortcuts, check the shortcut abbreviations shown in the menus of your apps. Every app can have its own shortcuts, and shortcuts that work in one app might not work in another.

  • Apple Music shortcuts: Choose Help > Keyboard shortcuts from the menu bar in the Music app.
  • Other shortcuts: Choose Apple menu > System Preferences, click Keyboard, then click Shortcuts.

Learn more

Run Command Line

  • Create your own shortcuts and resolve conflicts between shortcuts
  • Change the behavior of the function keys or modifier keys