Comments (4)
I tried the "it is not working" workaround in the readme page and then attempted the command line installation, with no luck:
secret@machine ~ % sudo rm -rf ~/.battery
binfolder=/usr/local/bin
sudo rm -v "$binfolder/smc" "$binfolder/battery"
Password:
rm: /usr/local/bin/smc: is a directory
rm: /usr/local/bin/battery: is a directory
secret@machine ~ % sudo rm -rf ~/.battery
secret@machine ~ % binfolder=/usr/local/bin
sudo rm -v "$binfolder/smc" "$binfolder/battery"
rm: /usr/local/bin/smc: is a directory
rm: /usr/local/bin/battery: is a directory
secret@machine ~ % sudo rm -v "/usr/local/bin/smc" "/usr/local/bin/battery"
rm: /usr/local/bin/smc: is a directory
rm: /usr/local/bin/battery: is a directory
secret@machine ~ % sudo rm -r "/usr/local/bin/smc" "/usr/local/bin/battery"
secret@machine ~ % curl -s https://raw.githubusercontent.com/actuallymentor/battery/main/setup.sh | bash
####################################################################
# 👋 Welcome, this is the setup script for the battery CLI tool.
# Note: this script will ask for your password once or multiple times.
####################################################################
🔋 Starting battery installation
[ 1/9 ] Superuser permissions acquired.
[ 2/9 ] Cloning fan control version of smc
bash: line 30: cd: /Users/secret/.battery-tmp/smc/smc-command: No such file or directory
[ 3/9 ] Building smc from source
[ 4/9 ] Move smc to executable folder
mv: rename /Users/secret/.battery-tmp/smc/smc-command/smc to /usr/local/bin/smc: No such file or directory
chmod: /usr/local/bin/smc: No such file or directory
[ 5/9 ] Cloning battery repository
[ 6/9 ] Writing script to /usr/local/bin/battery for user secret
cp: /Users/secret/.battery-tmp/battery/battery.sh: No such file or directory
chown: /usr/local/bin/battery: No such file or directory
chmod: /usr/local/bin/battery: No such file or directory
chmod: /usr/local/bin/battery: No such file or directory
chown: /usr/local/bin/battery: No such file or directory
bash: /Users/secret/.battery-tmp/battery/battery.sh: No such file or directory
[ 7/9 ] Set up visudo declarations
[ 8/9 ] Removing temp folder /Users/secret/.battery-tmp
[ 9/9 ] Removed temporary build files
🎉 Battery tool installed. Type "battery help" for instructions.
from battery.
Could you run this and show me the output?
tempfolder=~/.battery-tmp
smcfolder="$tempfolder/smc"
rm -rf $smcfolder
git clone --depth 1 https://github.com/hholtmann/smcFanControl.git $smcfolder
cd $smcfolder/smc-command
make
from battery.
Hi,
I ran your lines and got an error, found I was missing "xcode" so I installed it and rerun your lines again, which seemed to succeed although with a few warnings. See below.
After that it seems the app works for me, I can toggle the enable/disable without errors and got the message "Battery background component installed successfully" when I first ran the app.
Now I will monitor the charge but I think this is how it looks when the "charge limit" is in place and charging is on hold:
And I have just seen the battery level going down to 98% so looking good.
Thanks for the help and for sharing this app!
secret@machine ~ %
tempfolder=~/.battery-tmp &&
smcfolder="$tempfolder/smc" &&
rm -rf $smcfolder &&
git clone --depth 1 https://github.com/hholtmann/smcFanControl.git $smcfolder &&
cd $smcfolder/smc-command &&
make
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
secret@machine ~ % xcode-select --install
xcode-select: note: install requested for command line developer tools
secret@machine ~ %
tempfolder=~/.battery-tmp &&
smcfolder="$tempfolder/smc" &&
rm -rf $smcfolder &&
git clone --depth 1 https://github.com/hholtmann/smcFanControl.git $smcfolder &&
cd $smcfolder/smc-command &&
make
Cloning into '/Users/secret/.battery-tmp/smc'...
remote: Enumerating objects: 331, done.
remote: Counting objects: 100% (331/331), done.
remote: Compressing objects: 100% (174/174), done.
remote: Total 331 (delta 121), reused 251 (delta 102), pack-reused 0
Receiving objects: 100% (331/331), 1.42 MiB | 2.14 MiB/s, done.
Resolving deltas: 100% (121/121), done.
gcc -DCMD_TOOL_BUILD -c smc.c
smc.c:37:1: warning: 'OSSpinLock' is deprecated: first deprecated in macOS 10.12 - Use os_unfair_lock() from <os/lock.h> instead [-Wdeprecated-declarations]
OSSpinLock g_keyInfoSpinLock = 0;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libkern/OSSpinLockDeprecated.h:79:17: note: 'OSSpinLock' has been explicitly marked deprecated here
typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
^
smc.c:294:2: warning: 'IOMasterPort' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
IOMasterPort(MACH_PORT_NULL, &masterPort);
^~~~~~~~~~~~
kIOMainPortDefault
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:143:1: note: 'IOMasterPort' has been explicitly marked deprecated here
IOMasterPort( mach_port_t bootstrapPort,
^
smc.c:346:5: warning: 'OSSpinLockLock' is deprecated: first deprecated in macOS 10.12 - Use os_unfair_lock_lock() from <os/lock.h> instead [-Wdeprecated-declarations]
OSSpinLockLock(&g_keyInfoSpinLock);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libkern/OSSpinLockDeprecated.h:99:9: note: 'OSSpinLockLock' has been explicitly marked deprecated here
void OSSpinLockLock( volatile OSSpinLock *__lock );
^
smc.c:379:5: warning: 'OSSpinLockUnlock' is deprecated: first deprecated in macOS 10.12 - Use os_unfair_lock_unlock() from <os/lock.h> instead [-Wdeprecated-declarations]
OSSpinLockUnlock(&g_keyInfoSpinLock);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libkern/OSSpinLockDeprecated.h:105:9: note: 'OSSpinLockUnlock' has been explicitly marked deprecated here
void OSSpinLockUnlock( volatile OSSpinLock *__lock );
^
smc.c:395:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
sprintf(val->key, key);
^~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
smc.c:395:23: note: treat the string as an argument to avoid this
sprintf(val->key, key);
^
"%s",
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^
smc.c:668:22: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
sprintf(val.key, key);
^~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
smc.c:668:22: note: treat the string as an argument to avoid this
sprintf(val.key, key);
^
"%s",
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^
smc.c:778:34: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
sprintf(val.key, key);
^~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
smc.c:778:34: note: treat the string as an argument to avoid this
sprintf(val.key, key);
^
"%s",
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^
7 warnings generated.
gcc -mmacosx-version-min=10.4 -Wall -g -framework IOKit -o smc smc.o
ld: warning: object file (smc.o) was built for newer macOS version (13.0) than being linked (11.0)
from battery.
secret@machie ~ % battery status
12:51:14 - Battery at 87% (attached; remaining), smc charging disabled
12:51:14 - Your battery is currently being maintained at 80%
secret@machine ~ %
Working for me now, thank you!
from battery.
Related Issues (20)
- It would be nice if your application would respect XDG_CONFIG_HOME ($HOME/.config) HOT 1
- Option to Hide Battery Icon from Menu Bar for a Cleaner Interface HOT 3
- Battery level can be set to more than 100% HOT 1
- Question: How does this work? HOT 1
- Possibility to pause charge when battery has reached desired %. HOT 2
- Limit by voltage HOT 3
- sudo: smc: command not found HOT 9
- Error installing battery limiter: undefined HOT 4
- Battery fails to launch on MBP M1 HOT 3
- Hide icon from menu bar using cli command HOT 1
- removing app not possible HOT 1
- The App doesn't work wenn I go to idle state, lock screen or shut down and load over 80% in this condition. HOT 4
- limit hysteresis would be helpful HOT 6
- Sleeping momentarily while charging causes issues HOT 3
- What changes should I make to the "Optimized Battery Charging" setting? HOT 2
- Battery prevents Macbook from sleeping
- Can you port the CLI of battery to MacPorts?
- No percentage is displaying when the battery level is low
- No Icon is visible dis- or enable battery limit HOT 3
- Time Machine backups not starting reliably when "Back up on battery power" is off HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from battery.