LoginSignup
1
0

More than 3 years have passed since last update.

ローカル開発でコマンド一発で色々なサーバーを立ち上げる

Last updated at Posted at 2019-06-10

ローカル開発している時にフロントエンドやらバックエンドやらバッチやら、一つずつサーバー立ち上げるのが面倒くさいので、コマンド一発で複数立ち上げるようにしました。
以下のようなスクリプトを実行すると、Terminalのタブを複数開いてそれぞれでコマンドを実行してくれます。地味に便利です。(実行する時に権限が足りない時は、システム環境設定>セキュリティとプライバシー>プライバシー>アクセシビリティからターミナルの権限にチェックを入れてください。)

#!/bin/sh

osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'
osascript -e 'tell application "Terminal" to do script "cd ~/myproject && rails s" in selected tab of the front window'
osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'
osascript -e 'tell application "Terminal" to do script "cd ~/myproject && npm run dev" in selected tab of the front window'
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0