macOS Development Setup
macOS Development Environment Setup
This guide covers setting up a complete development environment for Netcap on macOS.
Prerequisites
1. Install Homebrew
If you don't have Homebrew installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"2. Install Go
Install Go 1.21 or later:
brew install goVerify installation:
go version3. Install Protocol Buffers Compiler
Netcap uses Protocol Buffers for efficient data serialization. Install the protoc compiler:
brew install protobufVerify installation:
protoc --versionProtocol Buffer Plugins
Netcap generates Protocol Buffer code for multiple languages. Install all required plugins:
Go Plugin (gogofaster)
The gogofaster plugin generates optimized Go code:
go install github.com/gogo/protobuf/protoc-gen-gogofaster@latestVerify installation:
which protoc-gen-gogofaster
# Should output: /Users/USERNAME/go/bin/protoc-gen-gogofasterSwift Plugin
For Swift code generation:
brew install swift-protobufVerify installation:
which protoc-gen-swift
# Should output: /opt/homebrew/bin/protoc-gen-swiftJavaScript Plugin
For JavaScript code generation:
npm install -g protoc-gen-jsVerify installation:
which protoc-gen-js
# Should output: /Users/USERNAME/.npm-global/bin/protoc-gen-js (or similar)Built-in Plugins
The following plugins are built into protoc and require no separate installation:
Python (
--python_out)Java (
--java_out)C++ (
--cpp_out)C# (
--csharp_out)
Verify All Plugins
Run this command to verify all plugins are installed:
echo "✓ protoc: $(protoc --version)"
echo "✓ protoc-gen-gogofaster: $(which protoc-gen-gogofaster)"
echo "✓ protoc-gen-swift: $(which protoc-gen-swift)"
echo "✓ protoc-gen-js: $(which protoc-gen-js)"Clone and Build Netcap
Clone the Repository
git clone https://github.com/dreadl0ck/netcap.git
cd netcapInstall Zeus Build System
Netcap uses the Zeus build system:
go install github.com/dreadl0ck/zeus/cmd/zeus@latestBuild Netcap
Build the project:
zeus installOr build manually:
go build -o /usr/local/bin/net github.com/dreadl0ck/netcap/cmdGenerate Protocol Buffers
Development Build (Go only)
For development, you typically only need Go code:
zeus gen-proto-devOr manually:
protoc --gogofaster_out=types/. netcap.protoRelease Build (All languages)
For a release build with all language bindings:
zeus gen-proto-releaseOr manually:
mkdir -p types/{python,java,swift,cpp,csharp,js}
protoc --gogofaster_out=types/. \
--python_out=types/python \
--java_out=types/java \
--swift_out=types/swift \
--cpp_out=types/cpp \
--csharp_out=types/csharp \
--js_out=types/js \
netcap.protoEnvironment Variables
Go Binary Path
Ensure your Go binary directory is in your PATH. Add to ~/.zshrc (or ~/.bash_profile):
export PATH="$HOME/go/bin:$PATH"Netcap Configuration
Set the configuration root if needed:
export NC_CONFIG_ROOT="$HOME/.config/netcap"Troubleshooting
protoc-gen-* not found errors
If you get errors like protoc-gen-XXX: program not found or is not executable:
Ensure the plugin is installed
Check if it's in your PATH:
echo $PATHFor Go plugins, ensure
$HOME/go/binis in your PATHFor Homebrew plugins, ensure
/opt/homebrew/binis in your PATH
Permission Issues
If you encounter permission errors when installing global npm packages:
# Configure npm to use a different directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
# Add to PATH in ~/.zshrc or ~/.bash_profile
export PATH="$HOME/.npm-global/bin:$PATH"
# Reload shell configuration
source ~/.zshrcProtocol Buffer Version Mismatch
If you encounter version mismatch errors, ensure you're using compatible versions:
# Check current versions
protoc --version
go list -m github.com/gogo/protobufAdditional Development Tools
Optional but Recommended
Install additional tools for development:
# Code formatting
go install golang.org/x/tools/cmd/goimports@latest
# Linting
brew install golangci-lint
# Testing utilities
go install github.com/rakyll/gotest@latest
# Profiling
go install github.com/google/pprof@latestNext Steps
Read the Contributing Guide
Check the Development Notes
Review the Testing Guide
Explore the Architecture Documentation
See Also
Installation Guide - For end-user installation
Quickstart - Getting started with Netcap
Configuration - Configuration options
Troubleshooting - Common issues and solutions
Last updated