---
title: "Configure Grafana Alloy on macOS | Grafana Cloud documentation"
description: "Learn how to configure Grafana Alloy on macOS"
---

# Configure Grafana Alloy on macOS

To configure Alloy on macOS, perform the following steps:

1. Edit the default configuration file at `$(brew --prefix)/etc/alloy/config.alloy`.
2. Run the following command in a terminal to restart the Alloy service:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   brew services restart  grafana/grafana/alloy
   ```

## Configure the Alloy service

> Note
> 
> Due to limitations in Homebrew, customizing the service used by Alloy on macOS requires changing the Homebrew formula and reinstalling Alloy.

To customize the Alloy service on macOS, perform the following steps:

1. Run the following command in a terminal:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   brew edit grafana/grafana/alloy
   ```
   
   This opens the Alloy Homebrew Formula in an editor.
2. Modify the `service` section as desired to change things such as:
   
   - Location of log files.
3. Modify the `COMMAND` in the `install` section as desired to change things such as:
   
   - The configuration file used by Alloy.
   - Flags passed to the Alloy binary.
4. Save the modified file.
5. Reinstall the Alloy Formula by running the following command in a terminal:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   brew reinstall --formula  grafana/grafana/alloy
   ```
6. Restart the Alloy service by running the command in a terminal:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   brew services restart  grafana/grafana/alloy
   ```

## Configure environment variables

You can use [environment variables](/docs/grafana-cloud/send-data/alloy/reference/cli/environment-variables/) to control the run-time behavior of Alloy. These environment variables are set in `$(brew --prefix)/etc/alloy/config.env`

To add the environment variables:

1. Edit the file at `$(brew --prefix)/etc/alloy/config.env`.
2. Add the specific environment variables you need.
3. Restart Alloy.

For example, you can add the following environment variables to `$(brew --prefix)/etc/alloy/config.env`:

shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```shell
export GCLOUD_RW_API_KEY="glc_xxx"
export GCLOUD_FM_COLLECTOR_ID="my-collector"
export GCLOUD_FM_LOG_PATH="/opt/homebrew/var/log/alloy.err.log"
```

## Configure command line flags

You can use the file at `$(brew --prefix)/etc/alloy/extra-args.txt` to pass multiple [command line flags](/docs/grafana-cloud/send-data/alloy/reference/cli/run/) to Alloy.

To add the command line flags:

1. Edit the file at `$(brew --prefix)/etc/alloy/extra-args.txt`.
2. Add the specific flags you need.
3. Restart Alloy.

For example, you can add the following command line flag in `$(brew --prefix)/etc/alloy/extra-args.txt` to enable the experimental components in Alloy.

shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```shell
--stability.level=experimental
```

## Expose the UI to other machines

By default, Alloy listens on the local network for its HTTP server. This prevents other machines on the network from being able to access the [UI for debugging](/docs/grafana-cloud/send-data/alloy/troubleshoot/debug/#alloy-ui).

To expose the UI to other machines, complete the following steps:

1. Follow [Configure the Alloy service](#configure-the-alloy-service) steps to edit command line flags passed to Alloy.
2. Modify the `COMMAND` line in the `install` section containing `--server.http.listen-addr=127.0.0.1:12345`, and replace `127.0.0.1` with the IP address that other machines on the network have access to. For example, the IP address of the machine Alloy is running on.
   
   To listen on all interfaces, replace `127.0.0.1` with `0.0.0.0`.
