DEV Community

Anuchit Prasertsang
Anuchit Prasertsang

Posted on

2 1

เปิด IntelliJ จาก command line terminal ใน macOS

ถ้าเราอยากสามารถเปิด IntelliJ ตอนที่เราอยู่ที่ terminal ได้เลย เราต้องไปเพิ่มคำสั่งเองได้เลย
ไปสร้างไฟล์ ชื่อ idea ไม่ต้องมีนามสกุลที่ /usr/local/bin/
ใส่คำสั่งในการรัน IntelliJ เข้าไปในไฟล์

#!/bin/sh

open -na "IntelliJ IDEA.app" --args "$@"
Enter fullscreen mode Exit fullscreen mode

-n : ถ้ามี IntelliJ เปิดอยู่แล้วให้เปิดหน้าต่างใหม่
-a : ระบุว่าให้เปิดโปรแกรมชื่ออะไร

จากนั้นเปลี่ยน permission ให้สามารถรันได้

chmod +x /usr/local/bin/idea
Enter fullscreen mode Exit fullscreen mode

เท่านี้ก็จะสามารถเปิด intelliJ จาก terminal ได้แล้ว

idea myfolder
Enter fullscreen mode Exit fullscreen mode

หรือ เปิดไฟล์

idea myfile.md
Enter fullscreen mode Exit fullscreen mode

ง่ายไหม

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay