Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Latest commit

 

History

History
102 lines (74 loc) · 6.06 KB

README.md

File metadata and controls

102 lines (74 loc) · 6.06 KB

BrewMyMac

GitHub workflow status Coverage Quality gate Vulnerabilities

Possibly the coolest way to install apps and customize your Mac!

Introduction

This article explains the motivation behind this project.

Getting started

Try it: https://brewmymac.sh

Supported package repositories

  • Homebrew: The missing package manager for macOS
  • Homebrew Cask: An extension to Homebrew that allows you to install macOS applications
  • App Store: A macOS app store platform maintained by Apple Inc

Supported macOS tweaks

  • macOS tweaks: A collection of over 50 macOS customizations

Frontend

The frontend is a React single-page application created using Create React App. The code is located under frontend directory.

Running locally

You need Node.js and npm installed on your machine.

  1. Install dependencies
    npm i --legacy-peer-deps
  2. Change the homepage URL in package.json to .
  3. This app uses Sentry to track errors and Mixpanel to track usage. You can create a .env file and adding your own keys by setting the REACT_APP_MIXPANEL_TOKEN and REACT_APP_SENTRY_DSN environment variables.
  4. Start the development server
    npm start
  5. Open http://localhost:3000 with your browser

Building from source

You need Node.js and npm installed on your machine.

  1. Install dependencies
    npm i --legacy-peer-deps
  2. Build the app
    npm run build
  3. The built app will be in the build folder

Backend

The backend is a Node.js application targeted to run as Azure Functions. The code is located under backend directory.

Deploying your own instance

Terraform is used to deploy the backend to Azure. The code is located under terraform directory.

  1. Install Terraform
  2. Install Azure CLI
  3. Build the backend
    cd backend
    npm run build
    cd ../terraform
  4. Authenticate with Azure: There are different ways to authenticate with Azure. See here for more details. Make sure the role running Terraform has the Contributor role on the subscription.
  5. Run terraform init to initialize the Terraform working directory. You will probably need to change the backend configuration in backends.tf to use a different way to manage your Terraform state.
  6. Run terraform plan to see what changes will be made to your infrastructure. You will probably need to change the variables.tf file to use a different resource group name, location, etc.
  7. Run terraform apply to apply the changes. You will probably need to change the variables.tf file as explained above.
  8. The backend will be deployed to Azure. You can now run the frontend locally or deploy it to Azure or GitHub Pages as well.
  9. You can run terraform destroy to destroy the backend when you no longer need it.

Architecture

Architecture

  1. The frontend is a React app hosted on GitHub Pages. This project does not involve any backend service implementation.
  2. The frontend app fetches a list of available apps from Homebrew via its Formulae API.
  3. The frontend app fetches a list of available apps from Homebrew Cask via its Formulae API.
  4. The frontend app searches for apps in Apple App Store via a public CORS proxy.
  5. The frontend app fetches a list of available macOS tweaks from a GitHub repository.
  6. When the user is ready to install apps and apply tweaks, the frontend app generates a shell script, upload it via a backend API (Azure Functions) and stores it in Cosmos DB. A link to download the shell script is generated and a single-line command is displayed to the user.
  7. The user opens Terminal in macOS.
  8. The user runs the single-line command that downloads the shell script via a backend API (Azure Functions).
  9. The shell script downloads an Ansible playbook for macOS tweaks from GitHub.
  10. The shell script installs apps using Homebrew and mas-cli, and applies macOS tweaks using Ansible.

License

BrewMyMac is open source software released under MIT.