Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"
@tungdmctv

This comment has been minimized.

Show comment
Hide comment

Cool !!

@cnstntn-kndrtv

This comment has been minimized.

Show comment
Hide comment
@alexadam819

This comment has been minimized.

Show comment
Hide comment

Thank you!

@maheshstms

This comment has been minimized.

Show comment
Hide comment

Thanks :)

@blackie1019

This comment has been minimized.

Show comment
Hide comment
@blackie1019

blackie1019 May 6, 2017

Awesome ! thanks!

Awesome ! thanks!

@aditya-kanekar

This comment has been minimized.

Show comment
Hide comment
@aditya-kanekar

aditya-kanekar May 15, 2017

Thanks! Thats really convenient and I learnt a new tool today.

Thanks! Thats really convenient and I learnt a new tool today.

@jaxon23

This comment has been minimized.

Show comment
Hide comment

jaxon23 commented May 21, 2017

Rock on!

@harshadbankar

This comment has been minimized.

Show comment
Hide comment

Awesome!

@tonysneed

This comment has been minimized.

Show comment
Hide comment
Owner

tonysneed commented Jun 19, 2017

@cnstntn-kndrtv thanks!

@bharathnayak03

This comment has been minimized.

Show comment
Hide comment

Thanks

@rabergman

This comment has been minimized.

Show comment
Hide comment
@rabergman

rabergman Aug 22, 2017

Exactly what I was looking for! Thanks!

Exactly what I was looking for! Thanks!

@ghost

This comment has been minimized.

Show comment
Hide comment

ghost commented Sep 2, 2017

thanks

@brunosilvano

This comment has been minimized.

Show comment
Hide comment
@brunosilvano

brunosilvano Oct 4, 2017

Thanks! Was struggling to find out how to do that for a while. Your solution works like a charm.

Thanks! Was struggling to find out how to do that for a while. Your solution works like a charm.

@ogzA

This comment has been minimized.

Show comment
Hide comment
@ogzA

ogzA Oct 6, 2017

I could open Visual Studio Code from terminal with "code ." but I needed that too. Thanks, that you have saved my life 👍

ogzA commented Oct 6, 2017

I could open Visual Studio Code from terminal with "code ." but I needed that too. Thanks, that you have saved my life 👍

@lobodpav

This comment has been minimized.

Show comment
Hide comment
@lobodpav

lobodpav Jan 4, 2018

The service can be further simplified this way. No need to execute a shell script.
service

lobodpav commented Jan 4, 2018

The service can be further simplified this way. No need to execute a shell script.
service

@lobodpav

This comment has been minimized.

Show comment
Hide comment
@lobodpav

lobodpav Jan 4, 2018

The App to be dragged into Finder's toolbar is also super easy to create.
app

Also, you can easily add VSCode icon to the Automator App so that it looks nice in Finder's toolbar - Cmd+I the VSCode and Automator app, click the VSCode icon and press Cmd+C. Then click the Automator App icon and press Cmd+V.
vscodecmdi
workflowcmdi

Once done, just drag&drop the Automator App onto Finder's toolbar while holding Cmd key. Final result looks like this.
finder

lobodpav commented Jan 4, 2018

The App to be dragged into Finder's toolbar is also super easy to create.
app

Also, you can easily add VSCode icon to the Automator App so that it looks nice in Finder's toolbar - Cmd+I the VSCode and Automator app, click the VSCode icon and press Cmd+C. Then click the Automator App icon and press Cmd+V.
vscodecmdi
workflowcmdi

Once done, just drag&drop the Automator App onto Finder's toolbar while holding Cmd key. Final result looks like this.
finder

@sozercan

This comment has been minimized.

Show comment
Hide comment
@rasikag

This comment has been minimized.

Show comment
Hide comment

rasikag commented Feb 18, 2018

Cool!

@monsieurkayode

This comment has been minimized.

Show comment
Hide comment
@monsieurkayode

monsieurkayode Mar 1, 2018

Nice, works like a charm

Nice, works like a charm

@jaltin

This comment has been minimized.

Show comment
Hide comment
@jaltin

jaltin Mar 9, 2018

Thanks, really useful!

jaltin commented Mar 9, 2018

Thanks, really useful!

@Tzira

This comment has been minimized.

Show comment
Hide comment

Tzira commented Mar 11, 2018

Thanks!

@apltola

This comment has been minimized.

Show comment
Hide comment
@apltola

apltola Apr 1, 2018

Nice! Thanks!

apltola commented Apr 1, 2018

Nice! Thanks!

@Dewiidar

This comment has been minimized.

Show comment
Hide comment
@Dewiidar

Dewiidar Apr 19, 2018

Thanks so much! Works like a charm!

Thanks so much! Works like a charm!

@RonHouben

This comment has been minimized.

Show comment
Hide comment
@RonHouben

RonHouben Jun 19, 2018

Thanks for this, very helpful and easy setup!

Thanks for this, very helpful and easy setup!

@mattwaler

This comment has been minimized.

Show comment
Hide comment
@mattwaler

mattwaler Jun 21, 2018

Everybody, you can just go to applications and cmd+click VS Code's application onto the top bar, which will allow you to drag folders onto it to open them into VSCode. No automator necessary. This also works for iTerm2.

Like This

Everybody, you can just go to applications and cmd+click VS Code's application onto the top bar, which will allow you to drag folders onto it to open them into VSCode. No automator necessary. This also works for iTerm2.

Like This

@justcaldwell

This comment has been minimized.

Show comment
Hide comment
@justcaldwell

justcaldwell Jul 13, 2018

Thanks @mattwaler! Great tip.

Thanks @mattwaler! Great tip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment