Environment setup
Complete setup instructions for developing the Dynamic Tags & Folders plugin in different environments.
Table of Contents
Section titled “Table of Contents”- Choosing Your Environment
- WSL (Windows Subsystem for Linux)
- PowerShell (Windows Native)
- Linux (Native)
- macOS
- Switching Between Environments
- Claude Code Considerations
- Troubleshooting
Choosing Your Environment
Section titled “Choosing Your Environment”Each environment has trade-offs:
| Environment | Pros | Cons | Best For |
|---|---|---|---|
| WSL | Linux tools + Windows filesystem access | Permission complexity | Windows users who prefer bash |
| PowerShell | Native Windows, no permission issues | Different command syntax | Windows users who prefer PowerShell |
| Linux | Pure Linux, fast, simple | No direct Windows access | Linux users |
| macOS | Unix-like, native | Apple hardware only | Mac users |
Recommendation:
- Windows users: WSL for better tooling, PowerShell for simplicity
- Linux/Mac users: Use your native environment
WSL (Windows Subsystem for Linux)
Section titled “WSL (Windows Subsystem for Linux)”Prerequisites
Section titled “Prerequisites”1. Enable WSL
Section titled “1. Enable WSL”# In PowerShell (Admin)wsl --installRestart your computer when prompted.
2. Install a Linux Distribution
Section titled “2. Install a Linux Distribution”# List available distributionswsl --list --online
# Install Ubuntu (recommended)wsl --install -d Ubuntu
# Or install from Microsoft Store:# - Ubuntu 22.04 LTS (recommended)# - Ubuntu 20.04 LTS# - Debian3. Set Up Linux User
Section titled “3. Set Up Linux User”When you first launch Ubuntu, you’ll be prompted to create a username and password.
Important: Remember this password - you’ll need it for sudo commands.
Install Development Tools
Section titled “Install Development Tools”1. Update Package Manager
Section titled “1. Update Package Manager”sudo apt updatesudo apt upgrade -y2. Install Node.js (if using npm)
Section titled “2. Install Node.js (if using npm)”# Install Node.js 20.xcurl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -sudo apt install -y nodejs
# Verify installationnode --versionnpm --version3. Install bun (Recommended)
Section titled “3. Install bun (Recommended)”# Install buncurl -fsSL https://bun.sh/install | bash
# Add bun to PATH (add to ~/.bashrc or ~/.zshrc)echo 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.bashrc
# Reload shell configurationsource ~/.bashrc
# Verify installationbun --version4. Install Git
Section titled “4. Install Git”sudo apt install -y git
# Configure gitgit config --global user.name "Your Name"git config --global user.email "your.email@example.com"File Permissions in WSL
Section titled “File Permissions in WSL”WSL can have complex permission issues when working with Windows files.
Understanding Permissions
Section titled “Understanding Permissions”# Check current permissionsls -la
# Files owned by root (created by Claude Code or sudo)-rw-r--r-- 1 root root 1234 Dec 01 12:00 file.txt
# Files owned by you-rw-r--r-- 1 youruser youruser 1234 Dec 01 12:00 file.txtFixing Permission Issues
Section titled “Fixing Permission Issues”# If files are owned by root, reclaim ownershipsudo chown -R $USER:$USER .
# Make files writablechmod -R u+w .
# After fixing permissions, reinstall dependenciesrm -rf node_modulesbun installPreventing Permission Issues
Section titled “Preventing Permission Issues”- Avoid using sudo unless absolutely necessary
- Clone repos in WSL home directory (
~) for better permissions - Use WSL paths (
/home/user/) instead of Windows paths (/mnt/c/Users/...)
Accessing Windows Files
Section titled “Accessing Windows Files”# Windows drives are mounted under /mnt/cd /mnt/c/Users/YourUsername/Documents
# Create symlink to Windows directory (optional)ln -s /mnt/c/Users/YourUsername/Documents/ObsidianVault ~/obsidian-vaultClone and Setup
Section titled “Clone and Setup”# Navigate to your project directorycd /mnt/c/Users/YourUsername/Documents/4\ VAULTS/plugin_development
# Clone the repositorygit clone https://github.com/cybersader/obsidian-tag-and-folder-mapper.gitcd obsidian-tag-and-folder-mapper
# Install dependenciesbun install
# Verify setupbun testbun x tsc -noEmit -skipLibCheckPowerShell (Windows Native)
Section titled “PowerShell (Windows Native)”Prerequisites
Section titled “Prerequisites”1. Install Package Manager
Section titled “1. Install Package Manager”Option A: Scoop (Recommended)
# Install ScoopSet-ExecutionPolicy RemoteSigned -Scope CurrentUserirm get.scoop.sh | iex
# Install packagesscoop install git nodejs bunOption B: Chocolatey
# Install Chocolatey (Admin PowerShell)Set-ExecutionPolicy Bypass -Scope Process -Force[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# Install packageschoco install git nodejs bunOption C: Manual Installation
- Node.js: Download from nodejs.org
- Git: Download from git-scm.com
- bun: Download from bun.sh
2. Verify Installations
Section titled “2. Verify Installations”# Check versionsnode --versionnpm --versionbun --versiongit --versionConfigure Git
Section titled “Configure Git”git config --global user.name "Your Name"git config --global user.email "your.email@example.com"Clone and Setup
Section titled “Clone and Setup”# Navigate to your project directorycd C:\Users\YourUsername\Documents\4 VAULTS\plugin_development
# Clone the repositorygit clone https://github.com/cybersader/obsidian-tag-and-folder-mapper.gitcd obsidian-tag-and-folder-mapper
# Install dependenciesbun install
# Verify setupbun testbun x tsc -noEmit -skipLibCheckPowerShell Tips
Section titled “PowerShell Tips”Enable Long Paths (Windows)
Section titled “Enable Long Paths (Windows)”# Enable long paths in registry (Admin PowerShell)New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -ForceExecution Policy
Section titled “Execution Policy”# If you get execution policy errorsSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserLinux (Native)
Section titled “Linux (Native)”Prerequisites
Section titled “Prerequisites”Ubuntu/Debian
Section titled “Ubuntu/Debian”# Update package managersudo apt updatesudo apt upgrade -y
# Install Node.js 20.xcurl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -sudo apt install -y nodejs
# Install buncurl -fsSL https://bun.sh/install | bash
# Add bun to PATHecho 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.bashrcsource ~/.bashrc
# Install Gitsudo apt install -y git
# Configure gitgit config --global user.name "Your Name"git config --global user.email "your.email@example.com"Fedora/RHEL
Section titled “Fedora/RHEL”# Update package managersudo dnf update -y
# Install Node.jssudo dnf install -y nodejs npm
# Install buncurl -fsSL https://bun.sh/install | bash
# Add bun to PATHecho 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.bashrcsource ~/.bashrc
# Install Gitsudo dnf install -y git
# Configure gitgit config --global user.name "Your Name"git config --global user.email "your.email@example.com"Arch Linux
Section titled “Arch Linux”# Update package managersudo pacman -Syu
# Install Node.jssudo pacman -S nodejs npm
# Install buncurl -fsSL https://bun.sh/install | bash
# Add bun to PATHecho 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.bashrcsource ~/.bashrc
# Install Gitsudo pacman -S git
# Configure gitgit config --global user.name "Your Name"git config --global user.email "your.email@example.com"Clone and Setup
Section titled “Clone and Setup”# Navigate to your project directorycd ~/projects
# Clone the repositorygit clone https://github.com/cybersader/obsidian-tag-and-folder-mapper.gitcd obsidian-tag-and-folder-mapper
# Install dependenciesbun install
# Verify setupbun testbun x tsc -noEmit -skipLibCheckPrerequisites
Section titled “Prerequisites”1. Install Homebrew
Section titled “1. Install Homebrew”# Install Homebrew/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"2. Install Development Tools
Section titled “2. Install Development Tools”# Install Node.jsbrew install node
# Install buncurl -fsSL https://bun.sh/install | bash
# Add bun to PATH (add to ~/.zshrc or ~/.bash_profile)echo 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.zshrcsource ~/.zshrc
# Install Git (usually pre-installed)brew install git
# Configure gitgit config --global user.name "Your Name"git config --global user.email "your.email@example.com"Clone and Setup
Section titled “Clone and Setup”# Navigate to your project directorycd ~/Documents/projects
# Clone the repositorygit clone https://github.com/cybersader/obsidian-tag-and-folder-mapper.gitcd obsidian-tag-and-folder-mapper
# Install dependenciesbun install
# Verify setupbun testbun x tsc -noEmit -skipLibCheckmacOS Tips
Section titled “macOS Tips”Apple Silicon (M1/M2/M3)
Section titled “Apple Silicon (M1/M2/M3)”Most tools work natively on Apple Silicon, but if you encounter issues:
# Check architectureuname -m# arm64 = Apple Silicon# x86_64 = Intel
# Force Rosetta (if needed)arch -x86_64 bun installSwitching Between Environments
Section titled “Switching Between Environments”Problem: esbuild Platform Mismatch
Section titled “Problem: esbuild Platform Mismatch”When switching environments, you may see:
You installed esbuild for another platform than the one you're currently using.Cause: esbuild installs platform-specific binaries. If you install in WSL but run in PowerShell (or vice versa), the wrong binaries are present.
Solution: Reinstall Dependencies
Section titled “Solution: Reinstall Dependencies”From WSL to PowerShell
Section titled “From WSL to PowerShell”# In PowerShellRemove-Item -Recurse -Force node_modulesbun installFrom PowerShell to WSL
Section titled “From PowerShell to WSL”# In WSLrm -rf node_modulesbun installBest Practice: Separate Environments
Section titled “Best Practice: Separate Environments”Option 1: Separate Clones
# WSL clone/mnt/c/Users/You/Documents/plugin-dev-wsl/
# PowerShell cloneC:\Users\You\Documents\plugin-dev-ps\Option 2: Use Platform-Aware Build Script
The project includes scripts/build.mjs which auto-detects your environment:
# Works in any environmentnode scripts/build.mjsClaude Code Considerations
Section titled “Claude Code Considerations”When working with Claude Code, there are special considerations for each environment.
How Claude Code Works
Section titled “How Claude Code Works”Claude Code may run commands:
- As a different user (potentially root/sudo in WSL)
- In a different environment than your shell
- With different permissions than your user
WSL with Claude Code
Section titled “WSL with Claude Code”Permission Issues
Section titled “Permission Issues”Claude Code may create files as root:
# Check file ownershipls -la
# If owned by root, fix:sudo chown -R $USER:$USER .
# Reinstall dependenciesrm -rf node_modulesbun installEnvironment Variables
Section titled “Environment Variables”Claude Code’s environment may differ from yours:
# Check Claude Code's environmentecho $PATHecho $USERecho $HOME
# If bun is not found, ensure it's in system PATH# Add to /etc/environment (requires sudo)PowerShell with Claude Code
Section titled “PowerShell with Claude Code”Execution Policy
Section titled “Execution Policy”Claude Code may have different execution policies:
# Check current policyGet-ExecutionPolicy
# If restricted, set for current userSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserPath Issues
Section titled “Path Issues”Ensure bun and npm are in system PATH, not just user PATH.
Best Practices
Section titled “Best Practices”- Let Claude Code handle: TypeScript compilation, testing
- You handle: Final builds, Obsidian testing, git commits
- Use platform-aware scripts:
node scripts/build.mjs - Verify independently: Always run
bun testyourself after changes - Fix permissions: Use
chownin WSL if files are owned by root
Troubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”Issue: command not found: bun
Section titled “Issue: command not found: bun”WSL/Linux/macOS:
# Check if bun is installedls ~/.bun/bin/bun
# If exists, add to PATHecho 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.bashrcsource ~/.bashrc
# If doesn't exist, installcurl -fsSL https://bun.sh/install | bashPowerShell:
# Check if bun is installedGet-Command bun
# If not found, reinstallirm bun.sh/install.ps1 | iexIssue: Permission denied
Section titled “Issue: Permission denied”WSL/Linux:
# Fix ownershipsudo chown -R $USER:$USER .
# Fix permissionschmod -R u+w .PowerShell:
# Run as Administrator# Right-click PowerShell → "Run as Administrator"Issue: esbuild platform mismatch
Section titled “Issue: esbuild platform mismatch”See Switching Between Environments above.
Issue: EACCES: permission denied, mkdir
Section titled “Issue: EACCES: permission denied, mkdir”WSL:
# Change npm global directory to user directorymkdir ~/.npm-globalnpm config set prefix '~/.npm-global'echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrcsource ~/.bashrcPowerShell:
# Run as Administrator# Or use scoop/chocolatey which handle permissionsIssue: Git line ending warnings
Section titled “Issue: Git line ending warnings”# Configure git to handle line endingsgit config --global core.autocrlf true # Windowsgit config --global core.autocrlf input # Linux/MacIssue: Can't find Python executable
Section titled “Issue: Can't find Python executable”Some npm packages require Python for native modules:
WSL/Linux:
sudo apt install -y python3macOS:
brew install python3PowerShell:
scoop install python# orchoco install pythonGetting Help
Section titled “Getting Help”If you encounter environment-specific issues:
- Check this guide first
- Check TESTING_GUIDE.md for testing issues
- Check CONTRIBUTING.md for development workflow
- Search existing issues
- Open a new issue with:
- Your environment (WSL/PowerShell/Linux/macOS)
- Output of
bun --version,node --version - Full error message
- Steps to reproduce
Quick Reference
Section titled “Quick Reference”Installation Commands
Section titled “Installation Commands”# WSL/Linuxsudo apt update && sudo apt install -y git nodejscurl -fsSL https://bun.sh/install | bashecho 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
# macOSbrew install git nodecurl -fsSL https://bun.sh/install | bashecho 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc# PowerShellirm get.scoop.sh | iexscoop install git nodejs bunVerify Installation
Section titled “Verify Installation”# All environmentsgit --versionnode --versionbun --versionProject Setup
Section titled “Project Setup”# All environmentsgit clone https://github.com/cybersader/obsidian-tag-and-folder-mapper.gitcd obsidian-tag-and-folder-mapperbun installbun testFix Common Issues
Section titled “Fix Common Issues”# WSL: Fix permissionssudo chown -R $USER:$USER . && rm -rf node_modules && bun install
# All: Fix platform mismatchrm -rf node_modules && bun installNext Steps
Section titled “Next Steps”After setting up your environment:
- Verify installation: Run
bun testto ensure 156 tests pass - Read the guides:
- CONTRIBUTING.md - Development workflow
- TESTING_GUIDE.md - How to test in Obsidian
- Start developing: Make changes and run
bun run devfor hot reload - Test in Obsidian: Create a test vault and load the plugin
License
Section titled “License”By using this setup guide, you agree to contribute under the MIT License.