Get started
Login
© 2024

macOS and iOS shortcuts

Tailscale works with the Shortcuts app on macOS and iOS to provide several built-in shortcut actions, allowing you to automate tasks. For example, you could create shortcuts to connect your device to a tailnet, use an exit node, or switch user accounts.

You can combine the Tailscale actions with other available actions to customize tasks, such as automatically connecting to your tailnet if your device is not on your home Wi-Fi.

Depending on how you set up your shortcuts, you access shortcuts in the Shortcuts app, the menu bar, in Spotlight, as well as other places.

Tailscale macOS and iOS shortcuts are supported on Tailscale v1.36 or later, for macOS 12.0 or later and iOS 15.0 or later.

For general information about macOS and iOS shortcuts, see Apple's documentation at Shortcuts User Guide for Mac and Shortcuts User Guide for iOS.

Tailscale provides support for the following actions:

Connection actions

  • Connect Connects your device to your tailnet.
  • Disconnect Disconnects your device from a tailnet.

Exit Node actions

  • Use Exit Node Starts using an exit node. You can specify an exit node by node name or by Tailscale IP. If you don't specify a name or Tailscale IP address, the shortcut user interface will prompt you to choose an exit node.
  • Stop Using Exit Node Stops using an exit node.

Using and stop using an exit node are sensitive actions, since an exit node affects all network traffic on your device. On iOS, an exit node action requires that your device is currently unlocked.

You must already have an exit node on your tailnet before you can use it from a macOS or iOS shortcut.

Switch Account action

  • Switch Account Switches user accounts. If you don't specify a user name to use when switching accounts, a user interface will prompt you to choose an account.

Get Status action

  • Get Status Retrieves Tailscale client status information.

The Get Status action returns values for the following.

  • Connected (boolean) Whether the device is connected to a tailnet.
  • Account Name (string) The Tailscale user name, for example, alice@example.com.
  • Using Exit Node (boolean) Whether the device is using an exit node.
  • Exit Node Name (string) The name of the exit node.

Switch accounts example

This example shows how to create a macOS shortcut that switches between Tailscale accounts. The example uses the Get Status action and the Switch Account action.

For general information about creating a macOS shortcut, see Apple's documentation at Create a custom shortcut on Mac.

  1. In the Shortcuts app, click File and then click New Shortcut.

  2. Click Shortcut Name and provide a name, such as Switch Tailscale user.

  3. In the right-hand panel, click Apps.

  4. Search for or scroll to the Tailscale app and click it.

  5. Drag the Get Status action to the shortcut editor.

  6. In the right-hand panel, search for the If action, and drag the If action to the shortcut editor and place it below the Get status statement. You can also find the If action by clicking Categories, Scripting, and then Control Flow.

  7. For the If statement, click Status and choose the Tailscale Account Name variable.

  8. Click Condition, click Is, and then click Text. Enter a user account, such as alice@example.com.

  9. From the right-hand panel, drag the Switch Account action to the shortcut editor, and place it below the If statement but above the Otherwise statement.

  10. For the Switch account to statement, click account name. For the value, use a different user account, such as alice@gmail.com.

  11. From the right-hand panel, drag another Switch Account action to the shortcut editor, and place it below the Otherwise statement but above the End if statement.

  12. Edit this Switch account to statement to use the original user account value, alice@example.com.

    Switch Tailscale user shortcut example
  13. Test your shortcut by clicking the Run icon at the top of the shortcut editor.

From the Shortcuts app, in the All Shortcuts folder, you can see the shortcut that you created. You can run the shortcut from that folder. You can also add the shortcut to the Menu Bar folder, which makes the shortcut appear in the macOS taskbar.

Connect to your tailnet example

This example shows how to create an iOS shortcut that automatically connects your device to your tailnet when your devices joins a specific Wi-Fi network. The example uses the Connect action.

In this example, the Wi-Fi network name is PangoLAN.

For general information about creating an iOS shortcut, see Apple's documentation at Create a custom shortcut on iPhone or iPad.

  1. In the Shortcuts app, choose the Automation tab from the bottom of the screen.

  2. Tap in the upper-right corner of the screen and choose Create Personal Automation.

  3. From the Wi-Fi category, choose the "PangoLAN" network.

  4. Tap Next.

  5. Tap Add Action.

  6. From the Tailscale app group, choose the Connect action.

  7. Tap Next.

  8. Tap Done.

    Switch Tailscale user shortcut example