Setting Up IntelliJ IDEA for Java Development on macOS
Step 1: Launch IntelliJ IDEA
Open IntelliJ IDEA from Launchpad or Applications.
Choose theme, keymap, and enable recommended plugins during first-time setup.
Step 2: Create a New Java Project
Click 'New Project'.
Choose Language: Java, Build System: Maven or Gradle (Maven is recommended).
Select JDK: If none is listed, click Add SDK > JDK and point to
/opt/homebrew/opt/openjdk.
Click Next, name your project (e.g., HelloWorld), choose location, and click Finish.
Step 3: Understand the Project Structure
src/main/java – Your Java source code.
src/test/java – Your unit tests.
pom.xml – Maven config file (if using Maven).
build.gradle – Gradle config file (if using Gradle).
Step 4: Create Your First Java Class
Right-click on src/main/java → New → Java Class.
Name it Main.
Add the following code:
Step 5: Run Your Application
Right-click the file → Run Main.main().
Or click the green triangle ▶ next to the main() method.
Step 6: Enable Auto Import & Save Features
Go to Settings (Cmd + ,) → Editor → General → Auto Import.
Enable 'Add unambiguous imports on the fly'.
Go to Settings → Tools → Actions on Save → Check 'Reformat code' and 'Optimize
imports'.
Step 7: Add Maven Dependencies (Optional)
Edit pom.xml to add dependencies. Example:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>3.2.0</version>
</dependency>
</dependencies>
Step 8: Terminal & Git Integration
Use the built-in terminal (⌥F12) or from View → Tool Windows → Terminal.
Version control: IntelliJ detects Git repos automatically, or use VCS → Enable Version
Control.
Step 9: Use Shortcuts to Be Productive
Run: Ctrl + R (⌃R)
Auto-import: Option + Enter (⌥Enter)
Rename: Shift + F6 (⇧F6)
Search class/file: Cmd + O / Shift + Cmd + O (⌘O / ⇧⌘O)
Terminal: Option + F12 (⌥F12)
Reformat code: Option + Cmd + L (⌥⌘L)
Step 10: Install Useful Plugins
Go to Preferences → Plugins.
Recommended: String Manipulation, Lombok, Rainbow Brackets, Key Promoter X, JUnit
Generator.