Saltar a contenido

Homebrew

Homebrew Package Manager

Comandos completos y flujos de trabajo para macOS y gestión de paquetes Linux.

Instalación > Configuración

Install Homebrew

# Install Homebrew (macOS/Linux)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Add to PATH (follow installer instructions)
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Operaciones básicas del paquete

Command Description
INLINE_CODE_5 Install package
INLINE_CODE_6 Uninstall package
INLINE_CODE_7 Upgrade all packages
INLINE_CODE_8 Upgrade specific package
INLINE_CODE_9 List installed packages
INLINE_CODE_10 List outdated packages

Package Information

Search and Information

Command Description
INLINE_CODE_11 Search for packages
INLINE_CODE_12 Show package information
INLINE_CODE_13 List installed packages with versions
INLINE_CODE_14 Show package dependencies
INLINE_CODE_15 Show packages that depend on this
INLINE_CODE_16 Open package homepage

Package Details

Command Description
INLINE_CODE_17 Show package description
INLINE_CODE_18 Show package formula
INLINE_CODE_19 Edit package formula
INLINE_CODE_20 Show package commit history
_
## Cask Management (GUI Applications)

Cask Operations

Command Description
INLINE_CODE_21 Install GUI application
INLINE_CODE_22 Uninstall GUI application
INLINE_CODE_23 List installed casks
INLINE_CODE_24 Search for casks
INLINE_CODE_25 Show cask information
INLINE_CODE_26 Upgrade all casks

Cascos populares

Cask Description
INLINE_CODE_27 VS Code editor
INLINE_CODE_28 Chrome browser
INLINE_CODE_29 Docker Desktop
INLINE_CODE_30 Slack messaging
INLINE_CODE_31 Zoom video conferencing
INLINE_CODE_32 Spotify music
_
## Services Management

Service Operations

Command Description
INLINE_CODE_33 List all services
INLINE_CODE_34 Start service
INLINE_CODE_35 Stop service
INLINE_CODE_36 Restart service
INLINE_CODE_37 Run service once
_
### Common Services
Service Description
--------- -------------
INLINE_CODE_38 PostgreSQL database
INLINE_CODE_39 MySQL database
INLINE_CODE_40 Redis cache
INLINE_CODE_41 Nginx web server
INLINE_CODE_42 MongoDB database
_
## Tap Management (Repositorios de terceros)

Tap Operations

Command Description
INLINE_CODE_43 List tapped repositories
INLINE_CODE_44 Add tap
INLINE_CODE_45 Remove tap
INLINE_CODE_46 Show tap information
Tap Description
INLINE_CODE_47 Fonts collection
INLINE_CODE_48 Alternative app versions
INLINE_CODE_49 Service management
INLINE_CODE_50 MongoDB packages

Mantenimiento del sistema

Operaciones de limpieza

Command Description
INLINE_CODE_51 Remove old versions
INLINE_CODE_52 Clean specific package
INLINE_CODE_53 Remove all old downloads
INLINE_CODE_54 Remove unused dependencies
_
## Health and Diagnostics
Command Description
--------- -------------
INLINE_CODE_55 Check system for issues
INLINE_CODE_56 Check for missing dependencies
INLINE_CODE_57 Show Homebrew configuration
INLINE_CODE_58 Show Homebrew version

Advanced Usage

Formula Development

Command Description
INLINE_CODE_59 Create new formula
INLINE_CODE_60 Edit formula
INLINE_CODE_61 Build from source
INLINE_CODE_62 Test formula

Version Management_

Command Description
INLINE_CODE_63 Pin package version
INLINE_CODE_64 Unpin package version
INLINE_CODE_65 Switch to specific version
INLINE_CODE_66 Show available versions
_
### Bundle Management
# Brewfile example
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"

brew "git"
brew "node"
brew "python"
brew "docker"

cask "visual-studio-code"
cask "google-chrome"
cask "slack"

mas "Xcode", id: 497799835
Command Description
INLINE_CODE_67 Install from Brewfile
INLINE_CODE_68 Create Brewfile
INLINE_CODE_69 Uninstall unlisted packages
INLINE_CODE_70 Check Brewfile status

Configuración

Environment Variables

Variable Description
INLINE_CODE_71 Installation prefix
INLINE_CODE_72 Package installation directory
INLINE_CODE_73 Homebrew repository location
INLINE_CODE_74 Download cache directory
_
### Configuration Files
File Description
------ -------------
INLINE_CODE_75 User configuration
INLINE_CODE_76 Installation directory (Apple Silicon)
INLINE_CODE_77 Installation directory (Intel)
INLINE_CODE_78 Package bundle file

Troubleshooting

Problemas comunes

Problem Solution
Permission errors INLINE_CODE_79
Outdated Xcode tools INLINE_CODE_80
Broken symlinks INLINE_CODE_81
Formula conflicts INLINE_CODE_82
_
## Reset and Reinstall
Command Description
--------- -------------
INLINE_CODE_83 Force uninstall
INLINE_CODE_84 Reinstall package
INLINE_CODE_85 Force link
INLINE_CODE_86 Remove dead symlinks

Debugging

Command Description
INLINE_CODE_87 Debug installation
INLINE_CODE_88 Verbose installation
INLINE_CODE_89 Create gist of logs

Performance Optimization

Parallel Operations

# Enable parallel downloads
export HOMEBREW_PARALLEL=4

# Disable analytics
export HOMEBREW_NO_ANALYTICS=1

# Use faster GitHub API
export HOMEBREW_GITHUB_API_TOKEN=your_token

Cache Management

Command Description
INLINE_CODE_90 Keep 7 days of downloads
INLINE_CODE_91 Check cache size
INLINE_CODE_92 Clear all cache

Seguridad

Verificación del paquete

Command Description
INLINE_CODE_93 Audit package formula
INLINE_CODE_94 Check formula style
INLINE_CODE_95 Show detailed install process
_
#### Safe Practices
1. Regular Updates: Mantener Homebrew y paquetes actualizados
2. Trusted Taps: Sólo agregue grifos de confianza de terceros
3. Revise las Fórmulas: Compruebe las fórmulas antes de la instalación
4. Backup: Mantener Brewfile para una fácil restauración
5. Permisiones: Evite correr con sudo

Integration

Integración Shell

# Bash completion
if type brew &>/dev/null; then
  HOMEBREW_PREFIX="$(brew --prefix)"
  if [[ -r "$\\\\{HOMEBREW_PREFIX\\\\}/etc/profile.d/bash_completion.sh" ]]; then
    source "$\\\\{HOMEBREW_PREFIX\\\\}/etc/profile.d/bash_completion.sh"
  fi
fi

# Zsh completion
if type brew &>/dev/null; then
  FPATH="$(brew --prefix)/share/zsh/site-functions:$\\\\{FPATH\\\\}"
  autoload -Uz compinit
  compinit
fi

Development Workflow

# Install development environment
brew install git node python ruby go rust
brew install --cask visual-studio-code docker

# Database setup
brew install postgresql redis
brew services start postgresql
brew services start redis

# Create project
mkdir myproject && cd myproject
npm init -y

Buenas prácticas

Package Management

  1. Mantenimiento regional: correr __INLINE_CODE_96_ semanal
  2. Cleanup: Limpieza regular de versiones antiguas y caché
  3. Bundle Files: Use Brewfile para la consistencia del equipo
  4. Pin Critical: Paquetes de pin que necesitan versiones específicas
  5. Documentación: Grabación y configuraciones personalizadas de documentos

Development Environment

  1. ** Gerentes de Versión**: Usar administradores de versiones para idiomas (nvm, pyenv, rbenv)
  2. Entornos virtuales: dependencias del proyecto de aislamiento
  3. ** Gestión de servicios**: Utilizar servicios de cerveza para bases de datos de desarrollo
  4. Manejo de la página: Mantenga PATH limpio y organizado
  5. Backup Strategy: Regular Brewfile dumps and dotfile backups

Performance

  1. ** Descargas paralelas**: Permitir operaciones paralelas
  2. ** Gestión del dolor**: Limpieza regular del caché
  3. Análisis: Desactivar el análisis para operaciones más rápidas
  4. GitHub Token: Use GitHub token for API rate limits
  5. ** Optimización del SSD**: Caché de almacén en almacenamiento más rápido