No such file or directory @ rb_sysopen libwebsockets,brew install mosquitto

brew install mosquitto下载的时候
No such file or directory @ rb_sysopen - /Users/hanpeng/Library/Caches/Homebrew/downloads/7afa1169044793ee334d7e9f9d50d95e58a53d9da172021196b88d216fdc9011–libwebsockets-4.3.1.arm64_monterey.bottle.tar.gz

hanpeng@hanpeng ~ % brew install mosquitto
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (ethereum/ethereum).

==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/cjson-1.7.
######################################################################## 100.0%
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/libevent-2
######################################################################## 100.0%
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/libwebsock
curl: (22) The requested URL returned error: 404                              

Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/libwebsockets/manifests/4.3.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libwebsockets/blobs/sha256:0315
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/mosquitto-
curl: (22) The requested URL returned error: 404                              

Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/mosquitto/manifests/2.0.14
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/mosquitto/blobs/sha256:92a59ffb
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Installing dependencies for mosquitto: cjson, libevent and libwebsockets
==> Installing mosquitto dependency: cjson
==> Pouring cjson-1.7.15.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/cjson/1.7.15: 23 files, 249.7KB
==> Installing mosquitto dependency: libevent
==> Pouring libevent-2.1.12.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libevent/2.1.12: 57 files, 2.1MB
==> Installing mosquitto dependency: libwebsockets
==> Pouring libwebsockets-4.3.1.arm64_monterey.bottle.tar.gz
Error: No such file or directory @ rb_sysopen - /Users/hanpeng/Library/Caches/Homebrew/downloads/7afa1169044793ee334d7e9f9d50d95e58a53d9da172021196b88d216fdc9011--libwebsockets-4.3.1.arm64_monterey.bottle.tar.gz

解决方法:先下载缺失的包,再下载目标包

hanpeng@hanpeng ~ % brew install libwebsockets-4.3.1.arm64_monterey.bottle.tar.gz
Error: No such file or directory @ realpath_rec - /Users/hanpeng/libwebsockets-4.3.1.arm64_monterey.bottle.tar.gz
hanpeng@hanpeng ~ % brew install libwebsockets                                 
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/libwebsock
curl: (22) The requested URL returned error: 404                              

Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/libwebsockets/manifests/4.3.1
Already downloaded: /Users/hanpeng/Library/Caches/Homebrew/downloads/6e7924c28b194db18b09950428a81d4c8c7e83110084bd4a75e728959528a923--libwebsockets-4.3.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/libwebsockets/blobs/sha256:0315
Already downloaded: /Users/hanpeng/Library/Caches/Homebrew/downloads/d989198348ad34b4aa59a17469337bac7b2f3db40710bc9e5280d69273b8cc61--libwebsockets--4.3.1.arm64_monterey.bottle.tar.gz
==> Pouring libwebsockets--4.3.1.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libwebsockets/4.3.1: 115 files, 2.5MB
==> `brew cleanup` has not been run in the last 30 days, running now...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/hanpeng/Library/Caches/Homebrew/ethereum--1.10.17.arm64_monterey.bottle.tar.gz... (65.5MB)
Removing: /Users/hanpeng/Library/Caches/Homebrew/cask_descriptions.json... (253.6KB)
Removing: /Users/hanpeng/Library/Caches/Homebrew/go--1.18.1.arm64_monterey.bottle.tar.gz... (167.9MB)
Removing: /Users/hanpeng/Library/Caches/Homebrew/Cask/docker--4.7.1,77678.dmg... (545.2MB)
Removing: /Users/hanpeng/Library/Logs/Homebrew/pkg-config... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/libtiff... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/xorgproto... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/libxau... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/libpng... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/pixman... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/gdbm... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/mpdecimal... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/libxdmcp... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/freetype... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/pango... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/gdk-pixbuf... (207B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/harfbuzz... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/glib... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/libxcb... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/readline... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/graphite2... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/cairo... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/sqlite... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/gobject-introspection... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/fribidi... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/libpthread-stubs... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/xz... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/fontconfig... (67.7KB)
Removing: /Users/hanpeng/Library/Logs/Homebrew/giflib... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/libxrender... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/openssl@3... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/gettext... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/librsvg... (197B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/libxext... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/pcre... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/jpeg... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/libx11... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/lzo... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/libffi... (64B)
Removing: /Users/hanpeng/Library/Logs/Homebrew/python@3.9... (2 files, 2.5KB)
Pruned 2 symbolic links and 7 directories from /opt/homebrew
hanpeng@hanpeng ~ % brew install mosquitto
Running `brew update --auto-update`...
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/mosquitto-2.0.14.arm64_monterey.bottle.tar.gz
curl: (22) The requested URL returned error: 404                              

Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/mosquitto/manifests/2.0.14
Already downloaded: /Users/hanpeng/Library/Caches/Homebrew/downloads/44b7c5d3b35e8a3232dded872ea031bff5c194f8b3b34dd5d69016abb781342e--mosquitto-2.0.14.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/mosquitto/blobs/sha256:92a59ffbdb47053e77f36675ef075449345dcea7bdc254526405aa31ed2d7a21
Already downloaded: /Users/hanpeng/Library/Caches/Homebrew/downloads/77610198c812f5587ef0b77170fa12b40fb98c25fd4b54a986ecb5111fc38924--mosquitto--2.0.14.arm64_monterey.bottle.tar.gz
==> Pouring mosquitto--2.0.14.arm64_monterey.bottle.tar.gz
==> Caveats
mosquitto has been installed with a default configuration file.
You can make changes to the configuration by editing:
    /opt/homebrew/etc/mosquitto/mosquitto.conf

To restart mosquitto after an upgrade:
  brew services restart mosquitto
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/mosquitto/sbin/mosquitto -c /opt/homebrew/etc/mosquitto/mosquitto.conf
==> Summary
🍺  /opt/homebrew/Cellar/mosquitto/2.0.14: 43 files, 1.7MB
==> Running `brew cleanup mosquitto`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
hanpeng@hanpeng ~ % 

使用 brew services start mosquitto 开启服务(brew services stop mosquitto停止服务)

hanpeng@hanpeng 2.0.14 % brew services start mosquitto
==> Successfully started `mosquitto` (label: homebrew.mxcl.mosquitto)

mosquitto的模块可以分为:
代理端(中转消息,守护进程) mosquitto
发送消息客户端 mosquitto_pub
接收消息客户端 mosquitto_sub
管理密码文件 mosquitto_passwd
使用

hanpeng@hanpeng 2.0.14 % mosquitto_sub -t news

开启一个接受消息的客户端,开启后进入接受状态。需要新打开一个窗口去开启一个发送消息的客户端

hanpeng@hanpeng 2.0.14 % mosquitto_pub -t news -m "hello"
hanpeng@hanpeng 2.0.14 % mosquitto_pub -t news -m "hello world"

接收端:

hanpeng@hanpeng 2.0.14 % mosquitto_sub -t news
hello
hello world

利用ps -ef |grep mosquitto 查看进程

hanpeng@hanpeng 2.0.14 % ps -ef | grep mosquitto               
  501 22063     1   0 10:45PM ??         0:00.14 /opt/homebrew/opt/mosquitto/sbin/mosquitto -c /opt/homebrew/etc/mosquitto/mosquitto.conf
  501 22119 21597   0 10:46PM ttys000    0:00.02 mosquitto_sub -t news
  501 22298 22128   0 10:48PM ttys001    0:00.00 grep mosquitto

发现有两个进程。其中mosquitto的启动命令为

/opt/homebrew/opt/mosquitto/sbin/mosquitto -c /opt/homebrew/etc/mosquitto/mosquitto.conf

接下来参考这个去配置的时候

# 关闭匿名
allow_anonymous false
# 设置用户名和密码
password_file ./pwfile
# 配置访问控制列表(topic和用户的关系)
acl_file ./acl
# 配置端口
port 8000

sudo mosquitto_passwd -c ./pwfile hp
sudo vim ./acl
# 用户test只能发布以test为前缀的主题
# 订阅以mqtt开头的主题
user test
topic write test/#
topic read mqtt/#

user hp
topic write mqtt/#
topic write mqtt/#

重启:brew services restart mosquitto

hanpeng@hanpeng mosquitto % ls
aclfile.example mosquitto.conf  pskfile.example pwfile.example
hanpeng@hanpeng mosquitto % vim mosquitto.conf 
hanpeng@hanpeng mosquitto % pwd
/opt/homebrew/Cellar/mosquitto/2.0.14/etc/mosquitto
hanpeng@hanpeng mosquitto % ls
aclfile.example mosquitto.conf  pskfile.example pwfile.example
hanpeng@hanpeng mosquitto % vim mosquitto.conf
hanpeng@hanpeng mosquitto % sudo mosquitto_passwd -c ./pwfile hp       
Password:
Password: 
Reenter password: 
hanpeng@hanpeng mosquitto % ls
aclfile.example mosquitto.conf  pskfile.example pwfile          pwfile.example
hanpeng@hanpeng mosquitto % vim pwfile.example 
hanpeng@hanpeng mosquitto % vim ./acl 
hanpeng@hanpeng mosquitto % brew services restart  mosquitto
Stopping `mosquitto`... (might take a while)
==> Successfully stopped `mosquitto` (label: homebrew.mxcl.mosquitto)
==> Successfully started `mosquitto` (label: homebrew.mxcl.mosquitto)
hanpeng@hanpeng mosquitto % mosquitto_pub -t news -m "111"
Error: Connection refused
hanpeng@hanpeng mosquitto % mosquitto_pub -t news -m "111" -u hp  -P 121314
Error: Connection refused
hanpeng@hanpeng mosquitto % mosquitto_pub -p 8000 -t news -m "111" -u hp  -P 121314
Error: Connection refused
hanpeng@hanpeng mosquitto % mosquitto_pub -p 8000 -t news -m "111" -u hp  -P 121314
Error: Connection refused
hanpeng@hanpeng mosquitto % mosquitto_pub -t news -m "hello"
Error: Connection refused
hanpeng@hanpeng mosquitto % mosquitto_sub -h 127.0.0.1 -p 8000 -t  qq  -v -u hp  -P 121314
Error: Connection refused
hanpeng@hanpeng mosquitto % ps -ef | grep mosquittp
  501 26802 22128   0 12:04AM ttys001    0:00.00 grep mosquittp
hanpeng@hanpeng mosquitto % ps -ef | grep mosquitto
  501 22119 21597   0 10:46PM ttys000    0:00.41 mosquitto_sub -t news
  501 26804 22128   0 12:04AM ttys001    0:00.00 grep mosquitto
hanpeng@hanpeng mosquitto % brew services start  mosquitto                       
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/hanpeng/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist` exited with 5.
hanpeng@hanpeng mosquitto % brew services start  mosquitto
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/hanpeng/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist` exited with 5.
hanpeng@hanpeng mosquitto % sudo brew services start mosquittp
Password:
Error: No available formula with the name "mosquittp". Did you mean mosquitto?
hanpeng@hanpeng mosquitto % sudo brew services start mosquitto
Warning: Taking root:admin ownership of some mosquitto paths:
  /opt/homebrew/Cellar/mosquitto/2.0.14/sbin
  /opt/homebrew/Cellar/mosquitto/2.0.14/sbin/mosquitto
  /opt/homebrew/opt/mosquitto
  /opt/homebrew/opt/mosquitto/bin
  /opt/homebrew/opt/mosquitto/sbin
  /opt/homebrew/var/homebrew/linked/mosquitto
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
Warning: mosquitto must be run as non-root to start at user login!
==> Successfully started `mosquitto` (label: homebrew.mxcl.mosquitto)
hanpeng@hanpeng mosquitto % mosquitto_sub -h 127.0.0.1 -p 8000 -t  qq  -v -u hp  -P 121314
Error: Connection refused
hanpeng@hanpeng mosquitto % ps -ef | grep mosquitto                           
  501 22119 21597   0 10:46PM ttys000    0:00.80 mosquitto_sub -t news
  501 28083 22128   0 12:13AM ttys001    0:00.00 grep mosquitto
hanpeng@hanpeng mosquitto % sudo brew services start mosquitto                            
Warning: Taking root:admin ownership of some mosquitto paths:
  /opt/homebrew/Cellar/mosquitto/2.0.14/sbin
  /opt/homebrew/Cellar/mosquitto/2.0.14/sbin/mosquitto
  /opt/homebrew/opt/mosquitto
  /opt/homebrew/opt/mosquitto/bin
  /opt/homebrew/opt/mosquitto/sbin
  /opt/homebrew/var/homebrew/linked/mosquitto
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
Warning: mosquitto must be run as non-root to start at user login!
/Library/LaunchDaemons/homebrew.mxcl.mosquitto.plist: service already bootstrapped
Bootstrap failed: 37: Operation already in progress
Error: Failure while executing; `/bin/launchctl bootstrap system /Library/LaunchDaemons/homebrew.mxcl.mosquitto.plist` exited with 37.
hanpeng@hanpeng mosquitto % ps -ef | grep mosquitto           
  501 22119 21597   0 10:46PM ttys000    0:00.85 mosquitto_sub -t news
  501 28266 22128   0 12:14AM ttys001    0:00.00 grep mosquitto
hanpeng@hanpeng mosquitto % ls
acl             aclfile.example mosquitto.conf  pskfile.example pwfile          pwfile.example
hanpeng@hanpeng mosquitto % vim acl
hanpeng@hanpeng mosquitto % ps -ef | grep mosquitto
  501 22119 21597   0 10:46PM ttys000    0:01.10 mosquitto_sub -t news
  501 28688 22128   0 12:20AM ttys001    0:00.00 grep mosquitto
hanpeng@hanpeng mosquitto % sudo brew services start mosquitto
Password:
Warning: Taking root:admin ownership of some mosquitto paths:
  /opt/homebrew/Cellar/mosquitto/2.0.14/sbin
  /opt/homebrew/Cellar/mosquitto/2.0.14/sbin/mosquitto
  /opt/homebrew/opt/mosquitto
  /opt/homebrew/opt/mosquitto/bin
  /opt/homebrew/opt/mosquitto/sbin
  /opt/homebrew/var/homebrew/linked/mosquitto
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
Warning: mosquitto must be run as non-root to start at user login!
/Library/LaunchDaemons/homebrew.mxcl.mosquitto.plist: service already bootstrapped
Bootstrap failed: 37: Operation already in progress
Error: Failure while executing; `/bin/launchctl bootstrap system /Library/LaunchDaemons/homebrew.mxcl.mosquitto.plist` exited with 37.
hanpeng@hanpeng mosquitto % brew services start mosquitto 
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/hanpeng/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist` exited with 5.
hanpeng@hanpeng mosquitto % ls
acl             aclfile.example mosquitto.conf  pskfile.example pwfile          pwfile.example
hanpeng@hanpeng mosquitto % vim mosquitto.conf 
hanpeng@hanpeng mosquitto % brew services start mosquitto
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/hanpeng/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist` exited with 5.
hanpeng@hanpeng mosquitto % brew services restart mosquitto 
Stopping `mosquitto`... (might take a while)
==> Successfully stopped `mosquitto` (label: homebrew.mxcl.mosquitto)
==> Successfully started `mosquitto` (label: homebrew.mxcl.mosquitto)
hanpeng@hanpeng mosquitto % ps -ef | grep mosquitto           
  501 29553     1   0 12:24AM ??         0:00.02 /opt/homebrew/opt/mosquitto/sbin/mosquitto -c /opt/homebrew/etc/mosquitto/mosquitto.conf
  501 22119 21597   0 10:46PM ttys000    0:01.26 mosquitto_sub -t news
  501 29561 22128   0 12:24AM ttys001    0:00.00 grep mosquitto
hanpeng@hanpeng mosquitto % ps -ef | grep mosquitto
  501 29553     1   0 12:24AM ??         0:00.02 /opt/homebrew/opt/mosquitto/sbin/mosquitto -c /opt/homebrew/etc/mosquitto/mosquitto.conf
  501 22119 21597   0 10:46PM ttys000    0:01.26 mosquitto_sub -t news
  501 29569 22128   0 12:24AM ttys001    0:00.00 grep mosquitto
hanpeng@hanpeng mosquitto % ps -ef | grep mosquitto
  501 29553     1   0 12:24AM ??         0:00.02 /opt/homebrew/opt/mosquitto/sbin/mosquitto -c /opt/homebrew/etc/mosquitto/mosquitto.conf
  501 22119 21597   0 10:46PM ttys000    0:01.26 mosquitto_sub -t news
  501 29573 22128   0 12:24AM ttys001    0:00.00 grep mosquitto
hanpeng@hanpeng mosquitto % mosquitto_pub -t news -m "hello"                              
hanpeng@hanpeng mosquitto % mosquitto_sub -h 127.0.0.1 -p 8000 -t  qq  -v -u hp  -P 121314
Error: Connection refused
hanpeng@hanpeng mosquitto % 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>homebrew.mxcl.mosquitto</string>
	<key>LimitLoadToSessionType</key>
	<array>
		<string>Aqua</string>
		<string>Background</string>
		<string>LoginWindow</string>
		<string>StandardIO</string>
		<string>System</string>
	</array>
	<key>ProgramArguments</key>
	<array>
		<string>/opt/homebrew/opt/mosquitto/sbin/mosquitto</string>
		<string>-c</string>
		<string>/opt/homebrew/etc/mosquitto/mosquitto.conf</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>WorkingDirectory</key>
	<string>/opt/homebrew/var/mosquitto</string>
</dict>
</plist>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值