Permission denied when installing MongoDB via Homebrew

hi there!
I’ve an issue while installing MongoDB in my Mac m1chip 2020.

error:Permission denied @ rb_sysopen - /Users/muppanasaikarthikeya/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

can anyone please help me with this.

Welcome to the MongoDB Community @Karthikeya_Muppana!

The error looks like a file permission problem and should be unrelated to using an M1 mac.

I would try running brew doctor via Terminal.app, as this will detect & resolve common permission and install issues that affect brew.

If brew doctor doesn’t help, I would try:

sudo chown $(whoami) ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

If neither of those suggestions are effective, can you confirm the command you were running when you encountered this error?

Regards,
Stennie