Launch Claude Cowork quickly from the current working directory

Launch Claude Cowork quickly from the current working directory

Claude Desktop can be opened with claude:// links. Here we introduce how to configure instant Cowork launch from Terminal and Finder.
2026.09.07

This page has been translated by machine translation. View original

This guide introduces how to launch Cowork from the current directory when you have a terminal or file manager open, for Mac users.

finder_highlight

Claude Desktop can handle URLs starting with claude://, just like https:// used on web pages.

The URL to open a new Cowork session has the following format:

claude://cowork/new

You can also attach a specified folder to Cowork by adding a folder parameter.

claude://cowork/new?folder=%2FUsers%2Fme%2Fdocs

claude://cowork/new?q=Draft%20the%20Q2%20update&folder=%2FUsers%2Fme%2Fdocs&file=%2FUsers%2Fme%2Fdocs%2Fnotes.md

You can verify the actual behavior by copying and pasting these URLs from your browser.

Using this mechanism, let's try launching Cowork on macOS from both the terminal and Finder.

Launching Cowork from the terminal

Simply register a cowork function in your .zshrc or similar file.

cowork() {
  local dir=${1:-.}

  [[ -d $dir ]] || {
    print -u2 -- "cowork: not a directory: $dir"
    return 1
  }

  dir=${dir:a}
  local encoded=$(/usr/bin/osascript -l JavaScript -e \
    'function run(a){return encodeURIComponent(a[0])}' "$dir") \
    || return 1

  /usr/bin/open "claude://cowork/new?folder=$encoded"
}

From the terminal, type $ type -f cowork to verify the function is registered correctly.

After confirming, call Cowork with $ cowork.

The working directory will be the current directory if no argument is given, or the specified directory if a folder is provided.

$ cowork

$ cowork doc-dir

Creating an Automator Quick Action

Launch Automator and select "Quick Action."

automator-menu

In the Quick Action settings screen, configure the items inside the red boxes below.

finder-highlight

  • "Workflow receives current": Folders
  • "in": Finder

Next, add "Run Shell Script" from the action list in the "Library" and configure it as follows.

  • Shell: /bin/zsh
  • Pass input: as arguments

Enter the following in the script field.

query=$(/usr/bin/osascript -l JavaScript -e 'function run(a){return a.map(p=>"folder="+encodeURIComponent(p)).join("&")}' "$@") || exit 1
/usr/bin/open "claude://cowork/new?$query"

Finally, save it with the name "Open in Cowork."

What the scripts are doing

Both scripts do only the following two things:

  • URL-encode the folder path
  • Construct a claude:// URL and pass it to open

Encoding is delegated to macOS's built-in osascript, and opening the URL is delegated to macOS's Launch Services.

The difference is how paths are received. The zsh version receives a single argument and needs to convert it to an absolute path, while the Automator version receives multiple absolute paths from Finder.

URL encoding with osascript

Folders and files used by Claude Cowork must be specified as full paths and URL-encoded.
For example, / is converted to %2F and a space to %20. osascript -l JavaScript is an option to execute scripts as JXA (JavaScript for Automation).

$ /usr/bin/osascript -l JavaScript \
  -e 'encodeURIComponent("/hoo/bar hoge")'
%2Fhoo%2Fbar%20hoge

The encoding itself can also be written with Python (urllib.parse.quote(s, safe='')) or jq, so feel free to use whichever suits your environment.

References


Claudeならクラスメソッドにお任せください

クラスメソッドは、Anthropic社とリセラー契約を締結しています。各種製品ガイドから、業種別の活用法、フェーズごとのお悩み解決などサービス支援ページにまとめております。まずはご覧いただき、お気軽にご相談ください。

サービス詳細を見る

Share this article

AI白書