-
-
Notifications
You must be signed in to change notification settings - Fork 27
Building on Mac
NOTE: the requirement on boost (and related setup steps) only applies to versions 2025.1 and earlier. The latest master no longer has any requirement on boost.
The builds below are described in detail, in case this assists someone.
Once nedit-ng is installed, you will want to change Apple's ⌘H
key-binding to be able to use "Find Selection" in Nedit-ng, otherwise your window disappears every time you try to do a search! In System Preferences go to Keyboard, Shortcuts, App Shortcuts and add an All Applications shortcut for Hide nedit-ng
. I set it to Shift+Option+Command+H ⌥⇧⌘H
but I never normally use these OS "Hide " keystrokes anyway so almost anything obscure would work for me. (Note, the exact phrase Hide nedit-ng
is replacing a system-wide Hide
binding of ⌘H
with a specific binding for nedit-ng .. which you may then choose not to use).
A fairly vanilla Macbook Air, running Mojave 10.14.6, Nov 2020.
Download nedit-ng-master.zip
from the green button labelled "Code" at https://github.com/eteran/nedit-ng. Unzip into a convenient location. This creates nedit-ng-master
.
You will need the base set of Xcode command-line tools. In a Terminal shell type xcode-select --install
A basic check that they have installed ok is: make
or make --version
.
Next install Homebrew. For background, see https://brew.sh/ and https://osxdaily.com/2018/03/07/how-install-homebrew-mac-os/ Homebrew is a very reputable repository of all sorts of Mac/Linux tools.
To install Homebrew, as per the main page https://brew.sh/ , use:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
You may need your system administrator password. This will take a couple of minutes to download and configure itself. On an Intel Mac, brew should end up in /usr/local/Homebrew. On an Apple Silicon (M1/M2) Mac it should end up in /opt/homebrew. This allows Intel and ARM brew code to co-exist.
Type brew
to be sure you have it, and can find it in your search PATH. brew config
will show useful info. brew list
will show the packages you have installed under brew - possibly none at this stage.
Next install cmake with brew install cmake
. Try cmake
, cmake --version
.
Now install bison with brew install bison
. The install may end with a suggested command to ensure that this bison (and not some older one the Mac has) is found first in your search PATH. Example:
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> /Users/myusername/.bash_profile
Issue that command in the Terminal, or edit your ~/.bash_profile, and start a new Terminal tab with Cmd-T, and check with bison --version
. The Mac default is very old, bison 2.3. This doesn't work for a nedit-ng build anymore.
Next install the Boost C++ library with brew install boost
. Again there may be an addition to your PATH suggested. brew info boost
will give you the version.
Next install the latest Qt5 library with brew install qt5
. There may be an addition to PATH suggested. Try brew info qt5
. Note that brew install qt
will get you qt6, not what we need.
Now we have all the tools and libaries. Build and install nedit-ng with ..
cd nedit-ng-master
mkdir build
cd build
cmake ..
make // There may be a number of "deprecated" and "cast" warnings, these are ok
make install // Optional. Copies the binaries to /usr/local/bin. You can manually copy them where you prefer.
Copy the binaries nedit-ng
, nc-ng
, nedit-import
to where you would like them, eg. $HOME/mybin
, or /usr/local/bin
.
- Import your old nedit settings and macros with
nedit-import nedit.rc
- Set preferred font and size from the Nedit-ng Preferences menu.
- Set preferred colour schemes from the Nedit-ng Preferences menu.
All done !
Macbook Pro with MacOS Catalina 10.15.7, Nov 2020.
Xcode Command-Line tools were already installed.
Download the nedit-ng source as above, and unzip.
Install Homebrew as above.
Install cmake, bison, boost, qt5 as above with the brew
command.
Build nedit-ng as above.
Note, as per Issue 174 ( https://github.com/eteran/nedit-ng/issues/174 ) if the build fails, you may need to set some env vars before you run cmake. This is based on Boost and QT5 having been installed by Homebrew. Adjust the paths as needed.
export BOOST_ROOT=/usr/local/Cellar/boost/1.74.0/
export Qt5_DIR=/usr/local/Cellar/qt/5.15.1
11.5 build, 23 July 21.
The process is the same as Catalina above. Versions of tools/libs (at MacOS 11.5):
brew 3.2.3 ( brew --version )
cmake 3.19.0-rc2 ( cmake --version )
bison 3.7.6 ( bison --version )
boost 1.76.0 ( brew info boost )
Qt 5.15.2 ( brew info Qt5 )
XCode 12.5.1 ( system_profiler SPDeveloperToolsDataType )
To do: Put the whole sequence as one list, just for reference. But don't recommend wildly running it in one blast !
The only difference with this combination seems to be that Homebrew is now installed into /opt/homebrew instead of /usr/local (that might be configurable, I didn't check). After installing the usual packages I updated the Makefile below to make that path switch easier to do, and the result builds and runs fine on the ARM64 M1 CPU.
Versions used on 2022-04-17:
- cmake version 3.23.1
- bison (GNU Bison) 2.3
- boost: stable 1.78.0 (bottled)
- qt@5: stable 5.15.3 (bottled)
The Makefile below can be used instead of having to set the above environment variables or edit your PATH to build, although suitable versions of the same software packages (cmake, bison, boost and Qt5) must be installed using Homebrew as described above. Copy the text below into a file named Makefile
in the top of the nedit-ng source tree, making sure that you use real tab characters to indent the lines below the # Build Rules
comment. Point the HOMEBREW
variable at your Homebrew installation (older versions may be in /usr/local
) and adjust the PREFIX
variable as desired, the setting given below will install into /usr/local/bin
. Then run make
to build and/or make install
to install the results.
# Build configuration
# Where Homebrew is installed
HOMEBREW=/opt/homebrew
# Where to install programs (to $(PREFIX)/bin)
PREFIX = /usr/local
# Dependencies, from Homebrew:
ENVS += BOOST_ROOT=$(HOMEBREW)/opt/boost
ENVS += Qt5_DIR=$(HOMEBREW)/opt/qt@5
export PATH := $(HOMEBREW)/opt/bison/bin:$(PATH)
CMAKE = $(HOMEBREW)/bin/cmake
# Build path
BUILD = Build
CMAKE_TARGETS = all install
CMAKE_OPTIONS += -DCMAKE_INSTALL_PREFIX=$(PREFIX)
# Build Rules
default: all
# NB: $(BUILD) is a real directory
$(BUILD):
mkdir $@
$(BUILD)/Makefile: | $(BUILD)
cd $(BUILD) && \
export $(ENVS) && \
$(CMAKE) $(CMAKE_OPTIONS) ..
$(CMAKE_TARGETS): %: $(BUILD)/Makefile
$(MAKE) -C $(BUILD) -j8 $@
clean:
test -f $(BUILD)/Makefile && \
$(MAKE) -C $(BUILD) $@
distclean:
rm -rf $(BUILD)
.PHONY: $(CMAKE_TARGETS) clean distclean
12 Jul 2022: Monterey 12.4
Versions:
- cmake version 3.23.2
- bison (GNU Bison) 3.8.2
- boost: 1.79.0
- qt@5: 5.15.5
- Xcode: 13.4.1
- MacOS: Monterey 12.4
Built fine. Note the -j8 in the Makefile above allows 8 threads which gives approx 5x speedup on build.
28 Jul 2022: Monterey 12.5, other versions as for 12.4. All fine. Note, if you have trouble with Qt files not found at runtime, check if you have installed qt6 in front of qt5. brew install qt
will install qt6. Use brew install qt5
to get qt5. You can brew uninstall qt6
or adjust some PATH vars to put /usr/local/opt/qt@5/bin
in the front of the path list.
Note, the brew packages were all Intel versions, installed in /usr/local. The final nedit-ng is Intel. So Rosetta 2 works well here. https://en.wikipedia.org/wiki/Rosetta_(software)#Rosetta_2
file nedit-ng: Mach-O 64-bit executable x86_64
Aug 2022: Lucky enough to acquire an M2 Macbook Air straight at launch (well, due to previous MBA being stolen on a trip). So this arrives as a vanilla 12.5 system.
- Installed brew as per https://brew.sh/ . . . . . . This installed into /opt/homebrew
brew install cmake
brew install bison
brew install boost
brew install qt5
- Add
export PATH="/opt/homebrew/opt/bison/bin:$PATH"
to .bash_profile as per suggestion at end of bison install - Add
export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"
to .bash_profile as per suggestion at end of qt install - xcode-select --install . . . . . Get the commandline developer tools, ie. compiler etc.
All these installed into /opt/homebrew. The brew packages are all arm64. The make of nedit-ng worked fine as per methods above. Final binary is fully arm64.
file nedit-ng: Mach-On 64-bit executable arm64
Versions: cmake 3.24.1, bison 3.8.2, boost 1.79.0, qt5 5.15.5, xcode-select 2395 (13.4)
Note if you try to copy over Intel/x86_64 nedit-ng binaries from another Apple Silicon m/c, built with some x86_64 tools and libs, and think that Rosetta will save you, you could waste hours adjusting PATH to libraries etc. I recommend to just build nedit from scratch in situ, as above. Maybe that's obvious.
01Apr23: Rebuilt a download of 31Mar23 on M1 Pro. Same process as above. Revs of tools:
brew 4.0.10 ( brew --version )
cmake 3.24.1 ( cmake --version )
bison 3.8.2 ( bison --version )
boost 1.81.1 ( brew info boost )
Qt 5.15.8 ( brew info Qt5 )
XCode 14.3 ( xcodebuild -version )
The version of nedit-ng is still 2020.1, I think we need a 2023.1 soon !
All builds and runs fine. I don't use many of the most recent features and fixes so can't confirm those.
31Mar24: Rebuild nedit-ng on Sonoma 14.4.1, M1 silicon. (Macbook Pro M1 Pro - too many Pro's there)
Update tools:
brew update
brew upgrade
brew --version: now 4.2.15
cmake had somehow gone AWOL, so ..
brew install cmake
cmake --version: 3.24.1
bison --version: 3.8.2
brew info boost: 1.84.0_1
brew info Qt5: 5.15.13
xcodebuild -version: 15.1
The build:
Ensure /usr/local/opt/cmake,bison,qt@5 are in PATH (.bashrc or .zshrc)
cd nedit-ng-master
mkdir build
cd build
cmake ..
make ( or make -j 4, or make -j )
make install (copies nedit-ng,nc-ng,nedit-import to /usr/local/bin)
or copy these binaries where you prefer, eg. ~/mybin
All seems to work fine. Thanks again Evan.
12 Jan 25: Diving in to a hot-off-the press 2025.1 build. On M1 Apple silicon.
Tools:
cmake --version 3.31.4
bison --version: 3.8.2
brew info boost: 1.87.0
brew info Qt5: 5.15.16
xcodebuild -version: 16.2
Build:
cd nedit-ng.2025.1
mkdir build
cd build
cmake ..
make (or make -j)
make install (copies nedit-ng,nc-ng,nedit-import to /usr/local/bin)
or copy these binaries where you prefer, eg. ~/mybin
file nc-ng nedit-ng nedit-import
all Mach-O 64-bit executable arm64
All working fine so far, but my nedit-ng usage is very basic. Thanks as always Evan, and contributors.
Useful Mac build info:
- https://earthly.dev/blog/homebrew-on-m1/
- https://github.com/orgs/Homebrew/discussions/545 and search for other related discussions
- https://docs.brew.sh/FAQ#why-is-the-default-installation-prefix-opthomebrew-on-apple-silicon and other topics on this FAQ page
- https://stackoverflow.com/questions/72560281/mac-m1-12-4-with-brew-arm-and-x86-versions-installed-how-do-i-uninstall-the-x86