๐—–๐—ฟ๐—ฒ๐—ฎ๐˜๐—ฒ ๐—” ๐—ก๐—ฒ๐˜„ ๐—จ๐˜€๐—ฒ๐—ฟ

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?

Setup Guide

First, install these tools:

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