> ## Documentation Index
> Fetch the complete documentation index at: https://flox.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Designing cross-platform environments

> Creating environments that run on different systems.

Flox makes it simple to have the **same [environment](/concepts/environments) on
multiple systems and CPU architectures**.
This guide walks through an example between two coworkers who have different
system types,
and shows how to customize your environment with system-specific dependencies.

## Creating an environment

To get started,
let's create an [environment](/concepts/environments) from a Linux laptop.
This laptop is using an ARM CPU (aarch64) which makes its full system
type `aarch64-linux`.

When using [`flox search`](/man/flox-search) you may see packages that won't immediately work with your manifest, but finding and allowing system specific packages is very easy.
Flox shows software from the following systems: `aarch64-darwin`, `x86_64-darwin`, `aarch64-linux`, and `x86_64-linux`.

Some packages may support only a subset of system types. You can inspect a
package with [`flox show`](/man/flox-show) to see what system types are supported:

```console theme={null}
$ flox show gdb
gdb - The GNU Project debugger
    gdb@14.2 (aarch64-linux, x86_64-darwin, x86_64-linux only)
    gdb@14.1 (aarch64-linux, x86_64-darwin, x86_64-linux only)
    gdb@13.2 (aarch64-linux, x86_64-darwin, x86_64-linux only)
    gdb@13.1 (aarch64-linux, x86_64-darwin, x86_64-linux only)
...
```

First let's install some packages to our environment running on Linux:

```console theme={null}
$ flox init --name eng-team-tools
⚡︎ Created environment eng-team-tools (aarch64-linux)
...
$ flox install gnupg vim
✔ 'gnupg' installed to environment eng-team-tools at /home/youruser
✔ 'vim' installed to environment eng-team-tools at /home/youruser
```

To make it easy to share this system across platforms we are going to share it
on FloxHub with [`flox push`](/man/flox-push).

```console theme={null}
$ flox push
✔ eng-team-tools successfully pushed to FloxHub

    Use 'flox pull youruser/eng-team-tools' to get this environment in any other location.
```

Learn more about this and other sharing options in the
[sharing environments guide](/tutorials/sharing-environments).

## Using the environment from a different system type

Many packages in Flox will work without any issue across system types.

To test this out, run [`flox pull`](/man/flox-pull) from another system such as an
Apple machine with an M-series processor.
This system type is `aarch64-darwin`.
Then let's run a simple `gpg --version` command to test everything is working.

```console theme={null}
$ flox pull youruser/eng-team-tools
⚡︎  Pulled youruser/eng-team-tools from https://hub.flox.dev

    You can activate this environment with 'flox activate'
$ flox activate -- gpg --version
gpg (GnuPG) 2.4.5
libgcrypt 1.10.3
Copyright (C) 2024 g10 Code GmbH
...
```

Looks like the environment works cross-platform, nice!

## Handling unsupported packages

However, some packages only work with a subset of systems.
To demonstrate this let's install a package that **isn't compatible with an Apple machine**.

From the Linux machine...

```console theme={null}
$ flox install systemd
! 'systemd' installed only for the following systems: aarch64-linux, x86_64-linux
```

Flox installs the package for all systems that it's compatible with,
but it skips Apple systems since they don't support the package.
We can push this update so we can list packages from the Apple machine to verify
everything works.

```console theme={null}
$ flox push
✔ Updates to eng-team-tools successfully pushed to FloxHub

    Use 'flox pull youruser/eng-team-tools' to get this environment in any other location.
```

Then, from the Apple machine, let's pull the latest and inspect the manifest.

```console theme={null}
$ flox pull
✔ Pulled youruser/eng-team-tools from https://hub.flox.dev/

You can activate this environment with 'flox activate'

$ flox list
gnupg: gnupg (2.4.5)
vim: vim (9.1.0377)

$ flox list -c
...
[install]
gnupg.pkg-path = "gnupg"
vim.pkg-path = "vim"
systemd.pkg-path = "systemd"
systemd.systems = ["aarch64-linux", "x86_64-linux"]
...
```

The Apple machine does not have `systemd`, because the `systemd.systems` list
specifies that `systemd` should only be installed on Linux.
This environment will activate on both machines and the Apple machine won't
get the `systemd` package.

## Where to next?

* [Environment concept](/concepts/environments)
