Building MWorks from source

Most users, including those developing custom plugins, do not need to compile MWorks themselves. However, for developers working on MWorks' internals or users interested in modifying core components, the following steps are the quickest route to building all of MWorks from source:

  1. Install Xcode. After installation, launch the application once so that it can install additional components as required.

  2. Check out the source code. Most development tasks should require only the main MWorks repository:

    git clone https://github.com/mworks/mworks.git
    

    However, if you want to build everything that goes in to the standard MWorks distribution, including optional plugins, you will need to check out the MWorks suite repository:

    git clone https://github.com/mworks/mw_suite.git
    cd mw_suite
    git submodule update --init --recursive
    

    Note that some components in the MWorks suite require additional software (e.g. API's and drivers) to be installed before compilation.

  3. Run the update_python_packages script:

    cd mworks/build
    ./update_python_packages
    

    The script will alert you if the required Python version is not installed. If so, follow the provided instructions, then run the script again.

  4. Configure code signing. The simplest way to do this is to create the file mworks/build/xcode/macOS_CodeSigning.xcconfig with the following contents:

    CODE_SIGN_IDENTITY = -
    CODE_SIGN_STYLE = Automatic
    

    This will tell Xcode to use "ad hoc" code signing, which is suitable for running MWorks on your build machine.

  5. Run the build_mworks script. This will download required supporting libraries and build and install all MWorks components, including applications, frameworks, plugins, scripting tools, and documentation:

    cd mworks/build
    ./build_mworks
    

    When prompted, enter your macOS account password. This is required to install items in the directories /Library/Application Support and /Library/Frameworks. If desired, you can eliminate the need to enter your password by running the command sudo visudo and adding the following to your sudoers file:

    # Allow admin group to prepare for an MWorks build without a password
    %admin ALL = NOPASSWD: \
      /bin/rm -Rf /Applications/MWClient.app, \
      /bin/rm -Rf /Applications/MWServer.app, \
      /bin/rm -Rf /Library/Application\ Support/MWorks, \
      /bin/rm -Rf /Library/Frameworks/MWorksCocoa.framework, \
      /bin/rm -Rf /Library/Frameworks/MWorksCore.framework, \
      /bin/rm -Rf /Library/Frameworks/MWorksPython.framework, \
      /bin/rm -Rf /Library/Frameworks/MWorksSwift.framework, \
      /bin/mkdir -m 775 /Library/Application\ Support/MWorks, \
      /bin/ln -s /Library/Application\ Support/MWorks/Frameworks/MWorksCocoa.framework /Library/Frameworks/MWorksCocoa.framework, \
      /bin/ln -s /Library/Application\ Support/MWorks/Frameworks/MWorksCore.framework /Library/Frameworks/MWorksCore.framework, \
      /bin/ln -s /Library/Application\ Support/MWorks/Frameworks/MWorksPython.framework /Library/Frameworks/MWorksPython.framework, \
      /bin/ln -s /Library/Application\ Support/MWorks/Frameworks/MWorksSwift.framework /Library/Frameworks/MWorksSwift.framework
    

Once these steps are complete, you can modify and build individual components directly via their Xcode projects.