macOS 越来越不面向开发者了, macOS 15 上竟然无法修改网卡 mac 并在重启后保持? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Rorysky
V2EX    macOS

macOS 越来越不面向开发者了, macOS 15 上竟然无法修改网卡 mac 并在重启后保持?

  •  
  •   Rorysky 2024-11-13 10:25:03 +08:00 1976 次点击
    这是一个创建于 382 天前的主题,其中的信息可能已经有所发展或是发生改变。

    改 mac 地址很简单就是用 ifconfig 命令,root 权限执行。 但问题是 ifconfig 在 wifi 连接的情况下是直接返回执行失败的(大概资源被当前网络连接占用),需要先将当前网络断开,但是这一步在 macOS 15 上没有对应的 命令行,14 以前的版本可以用 airport -z 实现,但是 airport 命令已经被苹果废弃了...

    大家有什么好办法么?

    3 条回复    2024-11-14 14:25:16 +08:00
    jmtsai
        1
    jmtsai  
       2024-11-13 14:01:31 +08:00
    sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z
    sudo ifconfig en0 ether [mac address]

    macos 14 和 15 都能用。目前 15.0.1 也运行正常
    eairjhioaegnh
        2
    eairjhioaegnh  
       2024-11-13 14:12:21 +08:00
    这个项目有 Wi-Fi 相关操作: https://github.com/digital-pers0n/Aerodrome/
    我提取了断开操作,我自己测试是可以的:

    //main.m

    #import <Foundation/Foundation.h>

    struct Apple80211;
    typedef struct Apple80211 *Apple80211Ref;

    int Apple80211Disassociate(Apple80211Ref wref);

    int Apple80211Open(Apple80211Ref *handle);

    int Apple80211Close(Apple80211Ref handle);

    int Apple80211BindToInterface(Apple80211Ref handle, CFStringRef interface);


    int main() {
    int error;
    Apple80211Ref ref;
    error = Apple80211Open(&ref);
    Apple80211BindToInterface(ref, CFSTR("en0"));

    if (error == 0) {
    Apple80211Disassociate(ref);
    } else {
    printf("%d\n", error);
    }
    Apple80211Close(ref);
    return 0;
    }
    // clang main.m -o main -O3 -F /System/Library/PrivateFrameworks -framework Apple80211 -framework Foundation && ./main
    netdcy
        3
    netdcy  
       2024-11-14 14:25:16 +08:00
    之前能在重启后保持修改的 mac 吗?
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2787 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 25ms UTC 14:06 PVG 22:06 LAX 06:06 JFK 09:06
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86