Showing posts with label macos. Show all posts
Showing posts with label macos. Show all posts

Friday, December 6, 2024

Ubuntu Multipass for x86 MBP

 

Ubuntu multipass

 
First download the tiny installer:
https://github.com/canonical/multipass/releases 
newer versions don't work on macos Monterey 12.6.7

Docs:

https://oscarchou.com/posts/handbook/multipass-command-cheatsheet/
https://medium.com/@karan.bk/modify-multipass-instances-update-resources-and-share-data-with-instance-c17315dd33d0
 https://medium.com/@karan.bk/a-beginners-guide-to-create-and-manage-ubuntu-vms-in-minutes-caa1684d9375
 

https://blog.humphd.org/multipass-on-macos/
https://fromanegg.com/post/2020/02/28/use-ubuntu-on-mac-os-with-multipass/
launch failed: multipass socket access denied

 https://github.com/canonical/multipass/issues/1437

 
 FYI, the new command is multipass auth. Note you must first issue multipass set local.passphrase as admin to set passphrase (and then enter this same passphrase when issuing the auth command).

H...Gi...4...!
 
 
https://discourse.ubuntu.com/t/ubuntu-frame-on-macos-including-apple-silicon-m1/28534 

Juju charms

charm-dev

Getting started with Juju 5 

 

 

 

 

 

Friday, August 9, 2024

building emacs on mac from source

Building emacs from source 

many github emacs don't build successfully
internet info outdated, changes in emacs 30.1 libjansson  not needed, gnutls deprecated
need macport information, most info on homebrew;
emacs source build works but is not packaged in a dmg
most fail when moved out of build directory
binaries download from: emacsformacos.com

 

Beautiful emacs site

https://www.masteringemacs.org/all-articles

Successful Emacs build on mac aarch64

builds for emacsforosx.com

https://github.com/caldwell/build-emacs

GNU Emacs 30.1 (build 1, aarch64-apple-darwin22.6.0, NS appkit-2299.77
 Version 13.7.4 (Build 22H420)) of 2025-03-16
Copyright (C) 2025 Free Software Foundation, Inc.


https://github.com/caldwell/build-emacs/issues/145
https://github.com/caldwell/build-emacs/issues/132
https://github.com/caldwell/build-emacs/issues/103#issuecomment-822056419

https://github.com/caldwell/build-emacs/issues/142#issuecomment-2730442280

Currently all my builds use Nix to automatically get dependencies, but it should work with manual dependency management using Homebrew/MacPorts/whatever as long as those dependencies are in your path when you run build-emacs-from-tar --no-deps (--no-deps should really be called --no-automatic-deps or something). Check the output of configure to see if it is detecting your dependencies.

Steps to resolve issue:

deleted previous build directory

git clone https://github.com/caldwell/build-emacs
./fetch-emacs-from-ftp -v ftp://ftp.gnu.org/pub/gnu/emacs
 

./build-emacs-from-tar -v -j 8 --no-deps emacs-30.1.tar.bz2 release

rustup target add x86_64-apple-darwin
make
./combine-and-package -v Emacs-30.1-13-arm64.tar.bz2

produced:
Emacs-30.1-universal.dmg

dependencies.nix

pkgs.mkShell {
  buildInputs = [
    pkgs.darwin.apple_sdk.frameworks.AppKit

    pkgs.autoconf
    pkgs.pkgconfig
    ncurses-no-nix-store
    pkgs.zlib

    pkgs.gnutls
    pkgs.jansson
    pkgs.libxml2
    pkgs.librsvg
    pkgs.tree-sitter
    pkgs.sqlite
  ];
}

Successful Emacs build on macos 12.7 x86_64 

https://github.com/imrehorvath/bundle-dylibs

https://imrehorvath.wordpress.com/2021/04/17/wanna-build-gnu-emacs-on-macos-from-source/

 

Use bundle_dylib to move libs inside Emacs.app. 


Efficient successful build 29.4 (138MByte)

https://github.com/mclear-tools/build-emacs-macos







Switch from macports to brew

MBP i5


Macbook Air M3

 

Install a few packages:

sudo port install autoconf

sudo port install automake

sudo port install texinfo

sudo port install gnutls

sudo port install pkgconfig

sudo port install libgcc13

 

EmacsWiki

gcc Emacs 

Get the source code.
# git clone --depth 1 --branch emacs-29.4 https://git.savannah.gnu.org/git/emacs.git emacs-29.4  
$ git clone git://git.savannah.gnu.org/emacs.git 
$ cd emacs
    
$ ./autogen.sh 
$ ./configure 
$ make 
$ make install
configure: error: ELisp native compiler was requested, but libgccjit was not found.
Please try installing libgccjit or a similar package. 
./configure --with-native-compilation result in libgccjit errors
  

Package Notes

libgcc-devel broken port #68421 
https://issues.guix.gnu.org/issue/57849
 
M3 build time: 11m16s
M3  build time with libgcc13: 1m12s
M1 build time:  1m5s

Compiling Emacs on Mac

builds for emacsforosx.com

https://github.com/caldwell/build-emacs

https://porkrind.org/missives/mac-os-x-codesigning-woes/


Renard mentions moving libs into a common directory to make it .app portable

https://github.com/renard/emacs-build-macosx
 

Standalone Emacs

https://gitlab.kitware.com/paraview/common-superbuild/-/blob/920d9bc5c6c69fd945df84668f50aca34cdf5f6f/cmake/scripts/fixup_bundle.apple.py


automated build 

https://github.com/jimeh/build-emacs-for-macos
credits:
https://gist.github.com/mikroskeem/0a5c909c1880408adf732ceba6d3f9ab#1-gcc-with-libgccjit-enabled

https://github.com/shshkn/emacs.d/blob/master/docs/nativecomp.md

https://gist.github.com/AllenDang/f019593e65572a8e0aefc96058a2d23e

 

Simple build script provided:


refs:


self-contained build
https://github.com/jimeh/emacs-builds

emacs plus features recent updates:

https://github.com/d12frosted/homebrew-emacs-plus

build emacs on mac using port:

https://mac4translators.blogspot.com/2017/10/evolution.html

Many other good sites:

https://www.zellysnyder.com/posts/compiling-emacs-on-macos/
https://www.mattduck.com/2021-05-upgrading-to-emacs-28.html
 
https://www.masteringemacs.org/article/speed-up-emacs-libjansson-native-elisp-compilation
https://andersmurphy.com/2021/11/14/emacs-building-from-source-on-macos.html 
https://emacs-ng.github.io/emacs-ng/build/building/
https://emacs.stackexchange.com/questions/58526/how-do-i-build-emacs-from-sources-on-macos-catalina-version-10-15-4
https://github.com/railwaycat/homebrew-emacsmacport?tab=readme-ov-file
https://www.reddit.com/r/emacs/comments/u28dji/emacs_28_with_nativecomp_on_macos_with_macports/
 

Native m1 builds

https://cpufun.substack.com/p/setting-up-the-apple-m1-for-native

https://github.com/jimeh/build-emacs-for-macos/issues/47

Create signing Certificate




m3 pkgs:
port installed
The following ports are currently installed:
  autoconf @2.72_0 (active)
  cctools @949.0.1_3+xcode (active)
-   cowsay @3.7.0_0 (active)
  curl-ca-bundle @8.12.1_0 (active)
  db48 @4.8.30_5 (active)
  gcc13 @13.3.0_2+stdlib_flag (active)
  gcc13-libcxx @13.3.0_2+clang16 (active)
  gcc_select @0.1_10 (active)
  gdbm @1.24_0 (active)
  gettext-runtime @0.22.5_0 (active)
  gmp @6.3.0_0 (active)
  gnutls @3.7.11_1 (active)
  icu @76.1_0 (active)
  isl @0.24_1 (active)
  ld64 @3_6+ld64_xcode (active)
  ld64-xcode @2_6 (active)
  libffi @3.4.6_1 (active)
  libgcc @9.0_0 (active)
  libgcc13 @13.3.0_2+stdlib_flag (active)
  libgcc14 @14.2.0_3+stdlib_flag (active)
  libiconv @1.17_0 (active)
  libidn2 @2.3.8_0 (active)
  libmpc @1.3.1_0 (active)
  libtasn1 @4.20.0_0 (active)
  libunistring @1.3_0 (active)
  libxml2 @2.13.6_0 (active)
  libxslt @1.1.42_0 (active)
  lz4 @1.10.0_0 (active)
  m4 @1.4.19_1 (active)
  mpfr @4.2.1_0 (active)
  ncurses @6.5_0 (active)
  nettle @3.10_0 (active)
  p11-kit @0.25.5_0 (active)
  perl5.34 @5.34.3_1 (active)
  pkgconfig @0.29.2_0 (active)
  readline @8.2.013_0 (active)
  texinfo @7.2_0+perl5_34 (active)
  xz @5.6.4_0 (active)
  zlib @1.3.1_0 (active)
  zstd @1.5.6_0 (active)



m1 pkgs:
The following ports are currently installed:
  autoconf @2.72_0 (active)
  automake @1.16.5_0 (active)
  brotli @1.1.0_0 (active)
  bzip2 @1.0.8_0 (active)
  cctools @949.0.1_3+xcode (active)
  curl @8.8.0_1+ssl
  curl @8.9.1_1+brotli+http2+idn+psl+ssl+zstd (active)
  curl-ca-bundle @8.8.0_0
  curl-ca-bundle @8.9.1_0 (active)
  db48 @4.8.30_5 (active)
  gdbm @1.24_0 (active)
  gettext-runtime @0.22.5_0 (active)
  gmp @6.3.0_0 (active)
  gnutls @3.7.11_0 (active)
  icu @74.2_0 (active)
  isl @0.24_1 (active)
  ld64 @3_6+ld64_xcode (active)
  ld64-xcode @2_6 (active)
  libedit @20240517-3.1_0 (active)
  libffi @3.4.6_1 (active)
  libgcc @8.0_0 (active)
  libgcc13 @13.3.0_1+stdlib_flag (active)
  libgcc14 @14.2.0_1+stdlib_flag (active)
  libgit2 @1.7.2_0+threadsafe (active)
  libiconv @1.17_0 (active)
  libidn2 @2.3.7_0 (active)
  libmpc @1.3.1_0 (active)
  libpsl @0.21.5-20240306_0 (active)
  libssh2 @1.11.0_0 (active)
  libtasn1 @4.19.0_0 (active)
  libunistring @1.2_0 (active)
  libxml2 @2.13.3_0 (active)
  libxslt @1.1.42_0 (active)
  lz4 @1.9.4_0
  lz4 @1.10.0_0 (active)
  m4 @1.4.19_1 (active)
  mpfr @4.2.1_0 (active)
  ncurses @6.5_0 (active)
  nettle @3.10_0 (active)
  nghttp2 @1.62.1_0 (active)
  openssl @3_18 (active)
  openssl3 @3.3.1_1 (active)
  p11-kit @0.25.5_0 (active)
  pcre2 @10.44_0 (active)
  perl5.34 @5.34.3_1 (active)
  pkgconfig @0.29.2_0 (active)
  readline @8.2.001_0 (active)
  starship @1.19.0_0
  starship @1.20.1_0 (active)
  texinfo @7.1_0 (active)
  xz @5.4.7_0 (active)
  zlib @1.3.1_0 (active)
  zstd @1.5.6_0 (active)




 

 



Saturday, June 29, 2024

emacs install rust-mode, universal binary, emacs-nw

Install rust-mode for emacs

https://github.com/rust-lang/rust-mode?tab=readme-ov-file#melpa

https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html 

https://melpa.org/#/getting-started

create 

touch ~/.emacs.d/init.el

add lines to init.el

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(package-refresh-contents)

 

Now you can install rust-mode with:

M-x package-install rust-mode

And put this in your config to load rust-mode automatically:

(require 'rust-mode)

emacs in the terminal

Prevent launching of a new window for emacs.

sudo ln -s /Applications/Emacs.app/Contents/MacOS/emacs-nw /usr/local/bin/emacs 


macOS emacs Universal Binary

emacs osx Universal binary 

lipo -arch almost pointless; tried it on the emacs Universal Binary only reduced the size by 4MB.  Not worth it.  

 man lipo

lipo -archs Emacs.app/Contents/MacOS/Emacs
 
lipo -remove x86_64 Emacs.app/Contents/MacOS/Emacs -output Emacs.app/Contents/MacOS/Emacs2
eclecticlight.co has an article about it:

Instant weight loss: how to strip Universal Apps

 

Installing emacs-nox (linux)

From PPA:

https://ubuntuhandbook.org/index.php/2022/06/install-gnu-emacs-28-1-ubuntu-22-04-20-04/ 

## Installing emacs from PPA ##
sudo apt remove --autoremove emacs emacs-common
sudo add-apt-repository ppa:ubuntuhandbook1/emacs
sudo apt install emacs-nox emacs-common


Other methods

https://gist.github.com/rscircus/77e91b36de1e431e0310611a32786e3c

 https://github.com/alexmurray/emacs-snap

 

Thursday, June 27, 2024

Considering nix on macOS

Considering nix on macOS

Stop the madness: Let's not go down this rabbit hole

I have known about nix and nixOS for a long, long time.  Eelco Dolstra was still a graduate student when I first took it for a spin.  It was cool; but I didn't need its features because I am not a developer.  port (macports.org) does everything I need.

Traffic Light: RED, STOP DO NOT PROCEED

Cons: 

instrusive, potentially irreversible changes?!?

complexity = steep learning curve.

creates giant (5GB+) separate volume to hold repository!

tiny community = good luck finding info

 

Pros: 

nix shell (shell with deps)

goodbye to docker containers to isolate dependencies and packages

 

General Purpose Nix Config for macOS + NixOS

https://github.com/dustinlyons/nixos-config?tab=readme-ov-file#general-purpose-nix-config-for-macos--nixos



A graphical installer for Nix

 
 
https://determinate.systems/posts/graphical-nix-installer/

Setting up Nix on macOS



zero-to-nix.com

 

6nok.org

How Fatih uses Nix on macOS

read more at the end

 

Ian Henry: blog posts on Nix

 

Upgrade your Development Environments with Devbox

Thursday, May 30, 2024

macos: check enrollment status

Check enrollment status

Launch terminal utility and type this:

sudo profiles status -type enrollment

You should see text like this in your terminal if Mac is not enrolled in management:

greyfin@dapple.local ~ % sudo profiles status -type enrollment
Enrolled via DEP: No
MDM enrollment: No

 


Friday, May 3, 2024

virtualizing linux m1 part 1

virtual ubuntu linux on m1

I wanted to run pop_os! on my m1 mac mini. 

Yay!

 Found UTM which is a slick frontend to qemu.  

Clipboard Sharing

Install spice-vdagent and reboot to enable clipboard sharing.

sudo apt install spice-vdagent

Woes

 x86 images are as slow as molasses.   Pop_os!  is only available in x86 iso.

arm64 are much faster; UTM has an image gallery where ubuntu 22.04 arm64 is available.

 

More Woes

Useful blog

https://blog.vkhitrin.com/booting-arch-linux-using-apple-virtualization-framework-with-utm/

UTM’s documentation.

Conclusion

 I'm out.  I have an old i7 I will run pop_os! on the bare hardware.

Wednesday, April 24, 2024

learning rust; installing rustup; macchina; build redox

rust / rustup /  cargo
 
rust

the language 

https://tourofrust.com/index.html

redox os (unix-like os written in rust)

rustup

macports had to migrate, old install was on Monterey now on Ventura 13.6.6

setup steps (with brew)

Install rustup package manager first and then have rustup install rustc, cargo.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup toolchain install stable

 

the rust compiler is rustc

To clean up debug and other build files:

cargo clean

Apple Silicon Development Set up for Rust


Using Rust from Python

Pyo3

 

 

Crux

Cross-platform app development in Rust

Learn how to use Crux in your project

 

 

GUI Tool kits

slint

iced 

Tauri 2.0

  https://www.youtube.com/watch?v=rC4FCS-oMpg

  https://github.com/makepad/makepad

 
 
 
Comfy - 2d game engine in Rust/wgpu

Leaving Rust gamedev after 3 years

Miniquad/Macroquad

  Using D lang to mix C++ and Rust.

www.tipi.build

https://www.youtube.com/watch?v=z6j-lCOi4XM

Corrosion.rs c++ rust bridge


apps

warp (advanced feature terminal; requires login)

gitoxide

media

Writing an OS in Rust

  Philipp Oppermann's blog

  

Brodie interviews Jeremy Soller developer of Redox OS

Building a secure Operating System (Redox OS) with Rust (Interview)

 

https://areweguiyet.com/

zed.dev

A fast new editor to try:

zed.dev (macos, build on linux)

Configuring Rust Analyzer

 

run PopOS arm64

Reddit discussion: Installation guide for Pop!_OS (arm64) on Apple Silicon
  works great using UTM.
  Installation Guide.
 
 UTM cheat sheet

disabling GNOME

Learn Rust

 Crust of Rust by Jon Gjengset



nala install pop_OS!

apt search nala
sudo apt install nala

sudo nala install curl

## install rustup toolchain manager
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

## install rustc and cargo
rustup toolchain install stable

sudo nala install git
sudo nala install build-essential
sudo nala install clang
sudo nala install strip-nondeterminism


 

compile macchina on pop_OS!

# install macchina alt to neofetch
# https://github.com/Macchina-CLI/macchina/wiki/Installation#build-for-everything-else
#
git clone https://github.com/grtcdr/macchina
cd macchina
cargo build --release

strip target/release/macchina
cargo run --release

Build redox disk img

mkdir -p ~/tryredox
cd ~/tryredox/git clone https://gitlab.redox-os.org/redox-os/redox.git --origin upstream --recursive
cd redox/
  370  make pull
  371  pwd
  372  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  373  nala search rust
  374  which rustc
  375  which cargo
  376  nala search rustc
  377  nala --help
  378  nala remove rustc
  379  sudo nala remove rustc
  380  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  381  exit
  382  which rust
  383  which rustc
  384  pwd
  385  cd tryredox/redox/
  386  make pull
  387  rustup --help
  388  cargo install --force cbindgen
  389  make pull
  390  cargo install --force nasm
  391  make pull
  392  nala search nasm
  393  nala install nasm
  394  sudo nala install nasm
  395  pwd
  396  make pull
  397  ls
  398  more build.sh
  399  ls
  400  pwd
  401  more README.md
  402  ./bootstrap.sh -d
  403  rustup toolchain list
  404  time make all
  405  ll
  406  cd build
  407  cd ..
  408  more README.md
  409  cd build
  410  ls
  411  cd x86_64/
  412  ls
  413  cd desktop/
  414  ll
  415  df -h .
  416  mount
  417  neofetch
  418  uptime
  419  sudo shutdown -h now


 
 
 

 



Tuesday, April 23, 2024

part 1:clean rust install

Note:

If you need rustc and cargo to learn rust you might not need rustup.  However it is required for most projects.   So follow this.

Install Rust (macos)

 curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh

 

The install (see above) is as easy as the official site (https://www.rust-lang.org/tools/install) says.   So why don't I like it?

Well I know I would have to:

  1. examine the script and try to figure out what it was doing
  2. write a note to myself about some directory paths
  3. review above note to uninstall 
  4. leave behind a bunch of left over files

Instructions

macport is the package manager I use.

download and install macports from macports.org

A how to for homebrew users.

You don't need xcode but you will need the tools.  Launch terminal and enter these commands:

xcode-select --install

sudo port install rust
sudo port install cargo

 

cd /opt/local/bin 

./rustc --version
rustc 1.77.1 (7cf61ebde 2024-03-27) (built from a source tarball)
 

Success you have installed rust!

macos 12.7 Monterey macbook pro 2.7 GHz Core i5 (I5-5257U)

Part 2: rustup; why


Tuesday, October 11, 2022

speed up oh my zsh launch

Slow Start Up

The first time I launch terminal (which I rarely do) it takes about 10 seconds to finish loading.  Way longer than it should but I didn't bother fixing it.

 

What Really Happened

Still slow, adding the two lines to .zshrc did not fix it. Commented them out.

Added:

export NVM_LAZY=1


Will not fix for now.

 

 

Fix

Launch your Terminal app.  I used the nano editor in Terminal. 

Edit .zshrc

 

nano .zshrc

then copy and paste, the lines below to the end of your .zshrc file

# configure node version manager
export NVM_DIR=~/.nvm [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" --no-use 
# This loads nvm
alias node='unalias node ; unalias npm ; nvm use default ; node $@'
alias npm='unalias node ; unalias npm ; nvm use default ; npm $@'
 

Info

 

 

 




Thursday, August 11, 2022

Solved: bootable ssd big sur m1 apple silicon

Creating bootable external ssd  macos big sur m1 apple silicon

I installed macos Big Sur 11.6.8 on an external 256GB m.2 NVME ssd connected to the Thunderbolt port on an m1 Apple Silicon machine.  I used both the standalone installer downloaded from the App Store and from macos Recovery mode (holding down the power button).

Each time install would fail at the first reboot of the installer.

The install log in the Installer gives a hint:

 bridge device not found 

Problem:
 
The ssd is bus powered; it is not powered up when the installer restarts.

Solution:

The external ssd needs an external power source.  I connected the ssd to a port on a drive dock with its own power brick.  After installation you can plug the external ssd into the Thunderbolt port again.  


In addition, remember to set your internal drive as the startup drive (Apple menu> system prefs>Startup Disk) when you disconnect your external ssd.  Your system may not start correctly if you don't set the startup disk.

This applies to macos Big Sur 11.6.8.


 

 

 



Thursday, October 14, 2021

emacs Universal build Intel x86_64 and arm64

emacs Intel, arm build

If you just want to install gnu emacs for macos and get going Emacs for MacOSX is the place to go.  

I did the builds on my early-2015 mbp with Big Sur 11.6.
  • read https://github.com/caldwell/build-emacs
  • download build scripts
 
I didn't install xcode.
xcode-select --install (installs command line tools)

install macports
sudo port install xz
./fetch-emacs-from-ftp -v ftp://ftp.gnu.org/gnu/emacs/
 
# port install xz
# if you need to convert xz to bz2
# xzcat -c emacs-27.2.tar.xz | bzip2 > emacs-27.2.tar.bz2

./build-emacs-from-tar -v emacs-27.2.tar.bz2 release 

Success:
Built Emacs-27.2-11.6-x86_64.tar.bz2, Emacs-27.2-11.6-x86_64-extra-source.tar

  • CODESIGN crash
Then I reproduced those same steps on an m1 mac mini with xcode13 installed and signed it:
  • ./combine-and-package -v --sign "Common Name" Emacs-27.2-11.6-arm64.tar.bz2 
    • replace "Common Name" with the name in the keychain access login cert.
  • see: code signing issue #103  
  • Success!  Thanks Emacs for MacOSX!
TODO:
Go back to the MBP and try the codesign step. 


 

 

 




 

Download Xcode 13 xip

Download Xcode 13 xip

I went on a search for Xcode which is on the App Store but also just downloadable:

 https://download.developer.apple.com/Developer_Tools/Xcode_13/Xcode_13.xip

Friday, August 13, 2021

Apple m1 Big Sur 11.5.2 update

macos Big Sur 11.5.2: Large update 

took longer than I thought it would

Updated my 2020 Apple m1 mac mini model A2348 with Big Sur 11.5.2
  • mystery update no release notes
  • see the excellent eclecticlight blog for more info
  • blaaaaarrgh whaaaaaaa: the update bar on reboot looked frozen. ugh. Five minutes later the text appeared with a time estimate, whew!
  • please can't some big brains at apple reduce the SIZE of these updates? How about 300MB?
  • RESULT: everything seems fine so far
  • Relocated Items folder: /etc/group trustd 282
  • Get rid of Other user on login screen; how to hide other users