# macho: handle \-install_name option for dylibs/MachO · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/a08137330c20ce77724a9fc80acf46a7e7978a90)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: a08137330c20ce77724a9fc80acf46a7e7978a90

Requested commit: a08137330c20ce77724a9fc80acf46a7e7978a90

Commit: a08137330c20ce77724a9fc80acf46a7e7978a90

Tree: 64495bae9db54d234e2bc78599a7594d7529d3d2

Author: Jakub Konka

Committer: Andrew Kelley

## Message

````
macho: handle -install_name option for dylibs/MachO

The status quo for the `build.zig` build system is preserved in
the sense that, if the user does not explicitly override
`dylib.setInstallName(...);` in their build script, the default
of `@rpath/libname.dylib` applies. However, should they want to
override the default behaviour, they can either:

1) unset it with

```dylib.setIntallName(null);```

2) set it to an explicit string with

```dylib.setInstallName("somename.dylib");```

When it comes to the command line however, the default is not to
use `@rpath` for the install name when creating a dylib. The user
will now be required to explicitly specify the `@rpath` as part
of the desired install name should they choose so like so:

1) with `build-lib`

```
zig build-lib -dynamic foo.zig -install_name @rpath/libfoo.dylib
```

2) with `cc`

```
zig cc -shared foo.c -o libfoo.dylib -Wl,"-install_name=@rpath/libfoo.dylib"
```

````

## Parents

- [9a8fdbe0a07ed9ece1d44634c6fe82c23b6209eb](https://git.cafe/gitcafe/zig/commit/9a8fdbe0a07ed9ece1d44634c6fe82c23b6209eb?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/a08137330c20ce77724a9fc80acf46a7e7978a90?format=markdown)
