ターミナルからAtomやVisual Studio Codeを起動する方法【Mac編 決定版】


ターミナルから AtomVisual Studio Code を起動する方法

ターミナルから特定のディレクトリやファイルを、 AtomVisual Studio Code から開けるようにする設定方法についてそれぞれ説明します。

# Atom でカレントディレクトリを開く
atom .

# VSCode でカレントディレクトリを開く
code .

ターミナルから Atom を起動する

Atom のインストール後に、atomというコマンドから起動できるようにエイリアスを貼ります。

  1. ~/.bash_profileに以下の1行を追加
    vimemacs などから.bash_profileを編集し、以下の1行を追加してください。

      alias atom="/Applications/Atom.app/Contents/Resources/app/atom.sh"
    
  2. source して有効にする

      source ~/.bash_profile
    

上記の手順の実行後、 bash から以下の方法で Atom を起動できます。

atom .

ターミナルから Visual Studio Code を起動する

Visual Studio Code を起動して設定します。

  1. Visual Studio Code を起動

  2. command + shift + p を押してコマンドパレットを開く。

  3. shell と入力して Shell Command: Install 'code' command in PATHを選択した状態で Enter でインストール

上記の手順の実行後、 bash から以下の方法で VSCode を起動できます。

code .