Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6817559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:04:13+00:00 2026-05-26T21:04:13+00:00

On Mac OS X, binary executables in the DYLD format contain loader commands that

  • 0

On Mac OS X, binary executables in the DYLD format contain “loader commands” that instruct the library loading system how to handle the contents of the file. In particular, the loader command instruct the system where dependent libraries should be searched for, etc.

You can see the complete list of loader commands for any binary on your system by running “otool -l /path/to/your/app”.

Generally speaking these loader commands are set by the “ld” tool during the link phase of a project’s compilation.

My question is, what do I need to do to add loader commands for publicized types that are not supported (apparently) by ld?

In particular, I would like to take advantage of the LC_DYLD_ENVIRONMENT loader commmand, which can be used to specify a string in the loader commands table of a binary that should be loaded and evaluated as environment variable settings in the context of the executable.

I don’t see any argument to ld that would facilitate this. Something like “-sectcreate” but for specifically adding to the content of the loader commands, is what I’m after.

I know this is possible because at least one standard app on Mac OS X uses it: Safari. But I don’t know whether they achieve this by some kind of post-link massage of the binary, if they’re using a custom version of ld that knows how to build and chain the custom loader command in, or if they are exploiting a general-purpopse feature of the ld command that I haven’t been able to figure out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:04:14+00:00Added an answer on May 26, 2026 at 9:04 pm

    It looks like you can use -dyld_env, like so: “-dyld_env DYLD_FRAMEWORK_PATH=/”. This isn’t documented in the man page, but can be found in ld64’s Options.cpp and mentioned in the Changelog file. If you’re trying to do it from Xcode, you’ll probably have to do it like this: “-Xlinker -dyld_env -Xlinker DYLD_FRAMEWORK_PATH=/”.

    One thing to note: if you look at dyld’s dyld.cpp, you’ll see that it only allows environment variables that start with DYLD_ and ends with _PATH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the SVN binary that comes with Mac OS X snow leopard.
I developed a command line application, whose binary runs in Linux, Windows and Mac
I want a python physics engine that works on mac and makes it easy
Thinking about UNIX, Windows and Mac and an output stream (both binary and text),
I have an app for the Mac that I am trying to archive. I
I want to ship a single 32/64-bit universal binary of my desktop Mac OS
I want to create a hex dump of a binary file in Mac OS
My Mac OS application links with a non-system-provided framework Foo.framework. I added a reference
I'm writing a (hopefully) small project that would end up being distributed in binary
What is Mac OS X binary plist structure? I could easy understand the XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.