Created
November 25, 2025 01:36
-
-
Save zerolagtime/fe6f49846814a9553b239a72490f3b94 to your computer and use it in GitHub Desktop.
Macbook Air Broadcom Offline Installing BroadcomWiFi Driver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # IMPORTANT - please do not run random scripts from the Internet unless | |
| # you have take the time to review them for potentially malicious actions. | |
| # This script should use information only available in the Ubuntu image | |
| # present in a bootable system and does not attempt to download resource | |
| # from other locations. Additionally, it does not attempt to do anything | |
| # other than activate kernel modules already present on the system. | |
| # | |
| # Select the "Show Apps" icon at the bottom and select "Terminal." | |
| # Find this folder with "cd /media/ubuntu" and look for your removable | |
| # storage under there. | |
| # This script is designed to get the 'wl' module working on a Macbook Air | |
| # model A1466. YMMV. A full list of supported chipsets is at | |
| # https://wiki.debian.org/wiki | |
| # At the time of writing, these chipsets are in the 'wl' driver | |
| # Broadcom BCM4311, BCM4312, BCM4313, BCM4321, BCM 4322, BCM43224, | |
| # BCM43224, BCM43226, BCM43228, BCM4331, BCM5352, BCM4360 | |
| # If you can temporarily get network access (dongle, ethernet adapter), | |
| # then use the Additional Drivers app to install the proprietary | |
| # "broadcom-sta-dkms" package and skip this script. | |
| # | |
| # Run: lspci -vnn |grep -i Net | |
| # If your chipset is either in the list above or in the Wiki above, | |
| # then this script is for you. If your chipset is not supported by 'wl', | |
| # then another path must be pursued. | |
| # If your chipset is supported, type: touch supported.txt | |
| # | |
| # Next: run this script on the Macbook Air to generate a list of needed packages. | |
| # This completes stage 1. | |
| # Follow the prompts to proceed through stage 2 on an Internet-connected | |
| # Linux or MacOS machine. Remember that this Mac might be rebootable back into | |
| # an old version of MacOS if you are truly pinched for systems. | |
| followed_directions() { | |
| test -f supported.txt | |
| } | |
| PACKAGE_URL_FILE=package-urls.txt | |
| is_live_cd() { | |
| lsblk |grep --silent /cdrom | |
| } | |
| is_stage3() { | |
| if [ "$(ls -1 *.deb 2>/dev/null |wc -l)" != "0" ]; then | |
| return 0 | |
| fi | |
| return 1 | |
| } | |
| not() { | |
| $@ | |
| if [ $? -eq 0 ]; then return 1; else return 0; fi | |
| } | |
| is_stage2() { | |
| not is_stage3 && test -f package-urls.txt | |
| } | |
| is_stage1() { | |
| is_live_cd && not is_stage2 && not is_stage3 | |
| } | |
| if ! followed_directions; then | |
| echo "=== ALERT! You ran a random script from the Internet and" | |
| echo "=== Did not inspect it. Read this script and follow" | |
| echo "=== the directions if you believe that this script" | |
| echo "=== will do what your want is is not hostile." | |
| exit 1 | |
| fi | |
| if is_stage1; then | |
| echo "=== Stage 1 - find packages to pull ===" | |
| apt-get install --download-only --print-uris \ | |
| broadcom-sta-dkms 2>/dev/null | \ | |
| grep -v cdrom: | grep :// | awk '{print $1}' | \ | |
| tr -d "'" > $PACKAGE_URL_FILE | |
| if [ ! -s $PACKAGE_URL_FILE ]; then | |
| echo "--- ERROR: No packages to pull. Manually install broadcom-sta-dkms" | |
| rm $PACKAGE_URL_FILE | |
| exit 1 | |
| fi | |
| echo "--- Stage 1 complete. Unmount this volume and run this script" | |
| echo "--- again from an internet-connected linux system, Ubuntu not required" | |
| exit 0 | |
| fi | |
| if is_stage2; then | |
| echo "=== Stage 1 - pull packages from Ubuntu repos ===" | |
| wget -i $PACKAGE_URL_FILE | |
| echo "--- Stage 2 complete. Unmount this volume and run this script" | |
| echo "--- again from the Macbook Air" | |
| exit 0 | |
| fi | |
| if is_stage3; then | |
| echo "=== Stage 3 - install pulled packages ===" | |
| sudo dpkg -i *.deb | |
| sudo apt-get install -y broadcom-sta-dkms | |
| sudo modprobe -r b44 b43 b43legacy ssb brcmsmac | |
| sudo rmmod b44 b43 b43legacy ssb brcmsmac | |
| sudo modprobe wl | |
| ifs=$(ip -br l |grep ^lo) | |
| if [ -z "$ifs" ]; then | |
| echo "--- Stage 3 failed. No new interfaces were created." | |
| exit 1 | |
| fi | |
| echo "--- Starting Gnome Control Center" | |
| gnome-control-center --search=Wi-Fi & | |
| echo "--- Stage 3 complete. Wifi should work. Keep this folder" | |
| echo "--- and rerun this script any time this image is booted as a LiveCD" | |
| echo "--- to re-enable WiFi - no need to download files again." | |
| exit 0 | |
| fi | |
| echo "ERROR: Start by running this script on the MacBook Air booted to a" | |
| echo " live CD of Ubuntu" | |
| exit 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment