๐๐ฟ๐ฒ๐ฎ๐๐ฒ ๐ ๐ก๐ฒ๐ ๐จ๐๐ฒ๐ฟ
Working on remote servers causes latency. Switching between local and remote environments wastes time. You can fix this by setting up a local coding agent on macOS.
Why use a local coding agent?
- Lower latency: Stop waiting for API calls or remote server updates.
- Faster development: Work locally and get instant feedback.
- Easy testing: Run tests without external systems.
- Better teamwork: Work on branches without pushing to a central repository.
Setup Guide
First, install these tools:
- Git
- Node.js
- Homebrew
- Docker (via brew install --cask docker)
Step 1: Create a new user
Run these commands to create a user and a group:
sudo groupadd coding_agent sudo useradd -m -s /usr/local/bin/bash coding_agent sudo usermod -g coding_agent coding_agent
Step 2: Configure the environment
Add these lines to your ~/.bashrc or ~/.zshrc file:
export CARGO_HOME=~ export REPO_PATH=/path/to/your/repo
Step 3: Run a Docker container
Use this command to start your agent in a container:
docker run --name coding_agent --net host --privileged --volume ~/repo:/repo --volume /tmp:/tmp your/image:latest
Step 4: Configure settings
Edit your config.json file inside the container:
{ "repo_path": "/repo", "working_dir": "/repo", "env_vars": [ { "name": "NODE_ENV", "value": "development" } ] }
Connect to your container:
docker exec -it coding_agent bash
Navigate to your code:
cd /repo your/app
Step 5: Automate startup
To start the agent on boot, use launchctl:
sudo launchctl load -w /System/Library/LaunchAgents/com.coding_agent.*
Create a ~/.launchd.conf file with this line:
start coding_agent;
A local agent makes your workflow efficient. It gives you a controlled environment for your code.
Source: https://dev.to/kelvin_kariuki_20f4bec616/create-a-new-user-47e