A simple bash script to quickly create new project directories from a template folder on macOS.
- Features
- Installation
- Usage
- Configuration
- Template Folder Structure
- Safety Features
- Troubleshooting
- Requirements
- License
- π Quickly scaffold new projects from a base template
- β Validates input and checks for existing directories
- π¨ Color-coded terminal output (because pretty terminals make us happy)
- π Safe operation with confirmation prompts (no accidental overwrites!)
- π Easy to customize and extend
- π― Interactive prompts ... just run and answer questions!
-
Download or copy the entire folder containing:
create-project.sh(the script)vscode-cpp-template/(your template folder with all base files)README.md(this documentation)
-
Make the script executable (required):
chmod +x create-project.sh
β οΈ Important: If you skip this step, you'll get a "permission denied" error!and then run the command
./create-project.sh
-
(Optional) Move to a directory in your PATH for global access:
# Note: You'll need to keep the template folder accessible sudo mv create-project.sh /usr/local/bin/create-projectThen you can run
create-projectfrom anywhere! π
Before running the script for the first time, make it executable (if you have not already done this):
chmod +x create-project.sh./create-project.shThe script will prompt you interactively:
Create new project
Directory name: my-awesome-app
Output path (leave empty for current directory): ~/Projects
This will create a new directory at the specified location, copying all files from the default base template folder.
π‘ Tip: Leave the output path empty to create your project in the current directory!
# Create a new project in current directory
./create-project.sh
# Directory name: my-awesome-app
# Output path: (press Enter for current directory)
# Create a new project in a specific location
./create-project.sh
# Directory name: gameDev
# Output path: ~/Documents/Projects
# Create a new project using a custom template
./create-project.sh ~/templates/web-template
# Directory name: web-project
# Output path: ~/Sites
# If installed globally
create-project
# Then enter your project details when prompted- Leave empty: Creates project in current directory
- Relative path:
../projectsorsubfolder - Absolute path:
/Users/yourname/Projects - Home directory:
~/Projects(tilde expands to your home directory)
π Note: If the path doesn't exist, the script will ask if you want to create it!
The script looks for a vscode-cpp-template folder in the same directory. Your folder structure should be:
CreateNewProjectFolder/
βββ create-project.sh # The script β¨
βββ vscode-cpp-template/ # Your template files
β βββ main.code-workspace
β βββ libstdc++-6.dll
β βββ ... (all your template files)
βββ README.md # This file!
The script automatically finds the template folder relative to its own location, so you can move the entire folder anywhere and it will still work.
If you want to use a different folder name, edit the script and change this line:
DEFAULT_BASE_FOLDER="$SCRIPT_DIR/template"For example, to use a folder named base-project:
DEFAULT_BASE_FOLDER="$SCRIPT_DIR/base-project"Your template folder (bundled with the script) should contain all the files and folders you want in every new project:
template/
βββ .gitignore
βββ README.md
βββ LICENSE
βββ src/
β βββ main.js
βββ tests/
β βββ test.js
βββ package.json
βββ .env.example
When you run the script, all of these files and folders will be copied to your new project directory.
- Existence Check: Validates that the template folder exists before proceeding
- Overwrite Protection: Prompts for confirmation if target directory already exists
- Error Handling: Exits on errors to prevent partial copies
Make sure the script is executable:
chmod +x create-project.shMake sure you have a template folder in the same directory as the script:
ls -la template/Your folder structure should be:
YourFolder/
βββ create-project.sh
βββ template/
Ensure you're using bash (default on macOS):
bash create-project.sh- macOS (or any Unix-like system with bash)
- Bash 3.0 or higher (included in macOS)
Free to use and modify as needed.
If you encounter issues, check that:
- The script has execute permissions
- Your template folder path is correct
- You have write permissions in the current directory
When you successfully create a project, you'll see this beauty:

Made with β€οΈ and lots of β